From 82be2070e2d48b9e26f9203d582fbd043b81b949 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 16 Feb 2002 10:11:00 +0000 Subject: [PATCH] Cutbuffer should be cleared when ^U is used in empty line (or in general, 0 chars is erased) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2471 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/gui-entry.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index fe2bf89b..1148d076 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -337,11 +337,11 @@ void gui_entry_erase(GUI_ENTRY_REC *entry, int size) { g_return_if_fail(entry != NULL); - if (entry->pos < size || size == 0) + if (entry->pos < size) return; /* put erased text to cutbuffer */ - if (entry->cutbuffer_len < size) { + if (entry->cutbuffer == NULL || entry->cutbuffer_len < size) { g_free(entry->cutbuffer); entry->cutbuffer = g_new(unichar, size+1); } @@ -351,6 +351,11 @@ void gui_entry_erase(GUI_ENTRY_REC *entry, int size) memcpy(entry->cutbuffer, entry->text + entry->pos - size, size * sizeof(unichar)); + if (size == 0) { + /* we just wanted to clear the cutbuffer */ + return; + } + g_memmove(entry->text + entry->pos - size, entry->text + entry->pos, (entry->text_len-entry->pos+1) * sizeof(unichar));