diff options
author | Timo Sirainen <cras@irssi.org> | 2002-02-16 10:11:00 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-02-16 10:11:00 +0000 |
commit | 82be2070e2d48b9e26f9203d582fbd043b81b949 (patch) | |
tree | 97cabe05b378bf3f93001cf1bbab4173cff845ce /src/fe-text/gui-entry.c | |
parent | 348a97db7c43593930b5fa17e5d9aba47ed4f75d (diff) | |
download | irssi-82be2070e2d48b9e26f9203d582fbd043b81b949.zip |
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
Diffstat (limited to 'src/fe-text/gui-entry.c')
-rw-r--r-- | src/fe-text/gui-entry.c | 9 |
1 files 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)); |