aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorThomas Meire <blackskad@gmail.com>2010-01-06 19:03:23 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-01-06 19:03:23 +0800
commit35c99e3a75272c03b71e04c3e1bf1944167295ee (patch)
treecc0b93673be69f31da08c5649bc973e3277f8d9b /libempathy-gtk
parent7b2c1fab3ca841fcf54cfb10d21eb0cc3fbbc7a3 (diff)
downloadgsoc2013-empathy-35c99e3a75272c03b71e04c3e1bf1944167295ee.tar
gsoc2013-empathy-35c99e3a75272c03b71e04c3e1bf1944167295ee.tar.gz
gsoc2013-empathy-35c99e3a75272c03b71e04c3e1bf1944167295ee.tar.bz2
gsoc2013-empathy-35c99e3a75272c03b71e04c3e1bf1944167295ee.tar.lz
gsoc2013-empathy-35c99e3a75272c03b71e04c3e1bf1944167295ee.tar.xz
gsoc2013-empathy-35c99e3a75272c03b71e04c3e1bf1944167295ee.tar.zst
gsoc2013-empathy-35c99e3a75272c03b71e04c3e1bf1944167295ee.zip
Fix autocompletion for non-alphanumeric nicknames
This bug is caused by the behaviour of gtk_text_iter_backward_word_start. It searches the text for delimiters, based on languages in pango. Numbers and characters as | and [ are not considered to be part of a word in most languages, while they are a part of nicknames. Therefore, empathy fails to get the typed part of the nickname. The attached patch will instead search backwards for a space character. The text that needs to be completed, is the text between the caret and the first space before that. (#554767)
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-chat.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 3e565585b..61a6f53ba 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1271,6 +1271,13 @@ chat_input_text_buffer_changed_cb (GtkTextBuffer *buffer,
}
static gboolean
+empathy_isspace_cb (gunichar c,
+ gpointer data)
+{
+ return g_unichar_isspace (c);
+}
+
+static gboolean
chat_input_key_press_event_cb (GtkWidget *widget,
GdkEventKey *event,
EmpathyChat *chat)
@@ -1364,7 +1371,9 @@ chat_input_key_press_event_cb (GtkWidget *widget,
/* Get the start of the nick to complete. */
gtk_text_buffer_get_iter_at_mark (buffer, &start, gtk_text_buffer_get_insert (buffer));
- gtk_text_iter_backward_word_start (&start);
+ if (gtk_text_iter_backward_find_char (&start, &empathy_isspace_cb, NULL, NULL)) {
+ gtk_text_iter_set_offset (&start, gtk_text_iter_get_offset (&start) + 1);
+ }
is_start_of_buffer = gtk_text_iter_is_start (&start);
list = empathy_contact_list_get_members (EMPATHY_CONTACT_LIST (priv->tp_chat));