stop forward word movement at the end of the text

This commit is contained in:
Daniel Micay 2012-09-08 17:41:58 -04:00
parent 7328e96110
commit a2bafff951
1 changed files with 8 additions and 2 deletions

View File

@ -212,7 +212,7 @@ static void move_backward(VteTerminal *vte, select_info *select, F predicate) {
return; return;
} }
glong length; long length;
gunichar *codepoints = g_utf8_to_ucs4(content, -1, NULL, &length, NULL); gunichar *codepoints = g_utf8_to_ucs4(content, -1, NULL, &length, NULL);
if (!codepoints) { if (!codepoints) {
@ -263,12 +263,18 @@ static void move_forward(VteTerminal *vte, select_info *select, F predicate) {
return; return;
} }
gunichar *codepoints = g_utf8_to_ucs4(content, -1, NULL, NULL, NULL); long length;
gunichar *codepoints = g_utf8_to_ucs4(content, -1, NULL, &length, NULL);
if (!codepoints) { if (!codepoints) {
return; return;
} }
// prevent going past the end (get_text_range adds a \n)
if (codepoints[length - 1] == '\n') {
codepoints[--length] = '\0';
}
bool end_of_word = false; bool end_of_word = false;
for (gunichar *c = codepoints; *c != 0; c++) { for (gunichar *c = codepoints; *c != 0; c++) {