mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
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
This commit is contained in:
parent
348a97db7c
commit
82be2070e2
@ -337,11 +337,11 @@ void gui_entry_erase(GUI_ENTRY_REC *entry, int size)
|
|||||||
{
|
{
|
||||||
g_return_if_fail(entry != NULL);
|
g_return_if_fail(entry != NULL);
|
||||||
|
|
||||||
if (entry->pos < size || size == 0)
|
if (entry->pos < size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* put erased text to cutbuffer */
|
/* put erased text to cutbuffer */
|
||||||
if (entry->cutbuffer_len < size) {
|
if (entry->cutbuffer == NULL || entry->cutbuffer_len < size) {
|
||||||
g_free(entry->cutbuffer);
|
g_free(entry->cutbuffer);
|
||||||
entry->cutbuffer = g_new(unichar, size+1);
|
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,
|
memcpy(entry->cutbuffer, entry->text + entry->pos - size,
|
||||||
size * sizeof(unichar));
|
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,
|
g_memmove(entry->text + entry->pos - size, entry->text + entry->pos,
|
||||||
(entry->text_len-entry->pos+1) * sizeof(unichar));
|
(entry->text_len-entry->pos+1) * sizeof(unichar));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user