Treat '_' as a word character too
This commit is contained in:
parent
b773ebb39c
commit
7ecabdad0b
@ -243,6 +243,14 @@ get_regex (const char *pattern,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline static gboolean
|
||||||
|
is_word_char (const GtkTextIter *iter)
|
||||||
|
{
|
||||||
|
gunichar c = gtk_text_iter_get_char (iter);
|
||||||
|
return c == '_' || g_unichar_isalnum (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_whole_word (const GtkTextIter *start,
|
is_whole_word (const GtkTextIter *start,
|
||||||
const GtkTextIter *end)
|
const GtkTextIter *end)
|
||||||
@ -254,19 +262,13 @@ is_whole_word (const GtkTextIter *start,
|
|||||||
|
|
||||||
if (!gtk_text_iter_starts_line (&s))
|
if (!gtk_text_iter_starts_line (&s))
|
||||||
{
|
{
|
||||||
gunichar c;
|
|
||||||
gtk_text_iter_backward_char (&s);
|
gtk_text_iter_backward_char (&s);
|
||||||
c = gtk_text_iter_get_char (&s);
|
if (is_word_char (&s))
|
||||||
if (g_unichar_isalnum (c))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_text_iter_ends_line (&e))
|
if (!gtk_text_iter_ends_line (&e) && is_word_char (&e))
|
||||||
{
|
return FALSE;
|
||||||
gunichar c = gtk_text_iter_get_char (&e);
|
|
||||||
if (g_unichar_isalnum (c))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user