soc.2008.finch: 169eb2bc: Some more minor fixes for the spell chec...

sadrul at pidgin.im sadrul at pidgin.im
Wed Sep 10 00:10:40 EDT 2008


-----------------------------------------------------------------
Revision: 169eb2bc4e6d76ff2e83e6f14e6f8a00aabb5515
Ancestor: 17fa710ebdd559c662be9f156a7dd744c01c6133
Author: sadrul at pidgin.im
Date: 2008-09-10T04:19:53
Branch: im.pidgin.soc.2008.finch
URL: http://d.pidgin.im/viewmtn/revision/info/169eb2bc4e6d76ff2e83e6f14e6f8a00aabb5515

Modified files:
        finch/libgnt/gntentry.c

ChangeLog: 

Some more minor fixes for the spell checking.

-------------- next part --------------
============================================================
--- finch/libgnt/gntentry.c	3a7d9fff88a0980205f366eb7e8df98e432be690
+++ finch/libgnt/gntentry.c	7c9959facc5a7da4200479c5bfbfe50e62fd9ee8
@@ -243,6 +243,7 @@ entry_removed_range(GntEntry *entry, con
 {
 #ifdef USE_ENCHANT
 	GntEntryWord *w, *next;
+	const char *rstart = from;
 	if (!entry->spell || !entry->spell->enable)
 		return;
 
@@ -276,7 +277,7 @@ entry_removed_range(GntEntry *entry, con
 		}
 	}
 
-	if (w && w->prev && w->start - (to - from + 1) == w->prev->start + w->prev->length) {
+	if (w && w->prev && w->start - (to - rstart + 1) == w->prev->start + w->prev->length) {
 		/* Whitespace was removed, causing two words to merge into one */
 		GntEntryWord *f = w;
 		w->prev->next = w->next;
@@ -286,12 +287,16 @@ entry_removed_range(GntEntry *entry, con
 		if ((w->checked_spell && w->misspelled) ||
 				(w->prev->checked_spell && w->prev->misspelled))
 			check_entry_word(entry, w->prev);
+		if (entry->spell->cursor_word == w)
+			entry->spell->cursor_word = w->prev;
+		if (entry->spell->scroll_word == w)
+			entry->spell->scroll_word = w->prev;
 		w = w->next;
 		g_free(f);
 	}
 
 	for (; w; w = w->next) {
-		w->start -= to - from + 1;
+		w->start -= to - rstart + 1;
 	}
 	set_cursor_position(entry, entry->cursor);
 	set_scroll_position(entry, entry->scroll);
@@ -1140,6 +1145,8 @@ gnt_entry_key_pressed(GntWidget *widget,
 						lastw->next = w;
 					} else {
 						w->next = entry->spell->word_list;
+						if (entry->spell->word_list)
+							entry->spell->word_list->prev = w;
 						entry->spell->word_list = w;
 						entry->spell->scroll_word = w;
 					}


More information about the Commits mailing list