[vte] widget: Simplify word-chars



commit e9b017895af86940b75f9f64e203974be0d0c602
Author: Christian Persch <chpe gnome org>
Date:   Wed Aug 13 14:05:31 2014 +0200

    widget: Simplify word-chars
    
    Until we implement full UAX29 word boundary detection, let's simplify the
    exception cases of ascii punctuation we don't want to include.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730632

 src/vte.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index a424c6f..bb67e9f 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -82,6 +82,8 @@ typedef gunichar wint_t;
 #define howmany(x, y) (((x) + ((y) - 1)) / (y))
 #endif
 
+#define WORD_CHAR_ASCII_PUNCT "-,.;/?%&#:_=+ ~"
+
 static void vte_terminal_set_visibility (VteTerminal *terminal, GdkVisibilityState state);
 static void vte_terminal_paste(VteTerminal *terminal, GdkAtom board);
 static void vte_terminal_real_copy_clipboard(VteTerminal *terminal);
@@ -5229,7 +5231,9 @@ _vte_is_word_char(gunichar c)
 {
        return g_unichar_isgraph(c) &&
                (g_unichar_isalnum(c) ||
-                g_unichar_ispunct(c));
+                (g_unichar_ispunct(c) &&
+                 (c >= 0x80 ||
+                  strchr (WORD_CHAR_ASCII_PUNCT, (int) c) != NULL)));
 }
 
 /* Check if the characters in the two given locations are in the same class


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]