changeset 15125:1bd757119ca7

[gaim-migrate @ 17911] Add action delete-next-word with a-d as the default binding. Unfortunately, this is also the default binding for the wm to dump an html screenshot. So you will need to unbind that first to make this work. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 07 Dec 2006 07:01:32 +0000
parents ed14c190a868
children 3fb20516042b
files console/libgnt/gntentry.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gntentry.c	Thu Dec 07 06:43:37 2006 +0000
+++ b/console/libgnt/gntentry.c	Thu Dec 07 07:01:32 2006 +0000
@@ -428,14 +428,16 @@
 }
 
 static gboolean
-move_forward_word(GntBindable *bind, GList *list)
+delete_forward_word(GntBindable *bind, GList *list)
 {
 	GntEntry *entry = GNT_ENTRY(bind);
 	GntWidget *widget = GNT_WIDGET(bind);
-	entry->cursor = (char *)next_begin_word(entry->cursor, entry->end);
-	while (gnt_util_onscreen_width(entry->scroll, entry->cursor) >= widget->priv.width) {
-		entry->scroll = g_utf8_find_next_char(entry->scroll, NULL);
-	}
+	char *iter = (char *)next_begin_word(entry->cursor, entry->end);
+	int len = entry->end - iter + 1;
+	memmove(entry->cursor, iter, len);
+	len = iter - entry->cursor;
+	entry->end -= len;
+	memset(entry->end, '\0', len);
 	entry_redraw(widget);
 	return TRUE;
 }
@@ -627,7 +629,7 @@
 	gnt_bindable_register_binding(bindable, "cursor-next", GNT_KEY_CTRL_F, NULL);
 	gnt_bindable_class_register_action(bindable, "cursor-next-word", move_forward_word,
 				"\033" "f", NULL);
-	gnt_bindable_class_register_action(bindable, "cursor-next-word", delete_forward_word,
+	gnt_bindable_class_register_action(bindable, "delete-next-word", delete_forward_word,
 				"\033" "d", NULL);
 	gnt_bindable_class_register_action(bindable, "suggest-show", suggest_show,
 				"\t", NULL);