summaryrefslogtreecommitdiff
path: root/src/fe-text/gui-entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-text/gui-entry.c')
-rw-r--r--src/fe-text/gui-entry.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c
index 42695917..01058355 100644
--- a/src/fe-text/gui-entry.c
+++ b/src/fe-text/gui-entry.c
@@ -334,23 +334,25 @@ char *gui_entry_get_cutbuffer(GUI_ENTRY_REC *entry)
return buf;
}
-void gui_entry_erase(GUI_ENTRY_REC *entry, int size)
+void gui_entry_erase(GUI_ENTRY_REC *entry, int size, int update_cutbuffer)
{
g_return_if_fail(entry != NULL);
if (entry->pos < size)
return;
- /* put erased text to cutbuffer */
- if (entry->cutbuffer == NULL || entry->cutbuffer_len < size) {
- g_free(entry->cutbuffer);
- entry->cutbuffer = g_new(unichar, size+1);
- }
+ if (update_cutbuffer) {
+ /* put erased text to cutbuffer */
+ if (entry->cutbuffer == NULL || entry->cutbuffer_len < size) {
+ g_free(entry->cutbuffer);
+ entry->cutbuffer = g_new(unichar, size+1);
+ }
- entry->cutbuffer_len = size;
- entry->cutbuffer[size] = '\0';
- memcpy(entry->cutbuffer, entry->text + entry->pos - size,
- size * sizeof(unichar));
+ entry->cutbuffer_len = size;
+ entry->cutbuffer[size] = '\0';
+ memcpy(entry->cutbuffer, entry->text + entry->pos - size,
+ size * sizeof(unichar));
+ }
if (size == 0) {
/* we just wanted to clear the cutbuffer */
@@ -391,7 +393,7 @@ void gui_entry_erase_word(GUI_ENTRY_REC *entry, int to_space)
}
if (to > 0) to++;
- gui_entry_erase(entry, entry->pos-to);
+ gui_entry_erase(entry, entry->pos-to, TRUE);
}
void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space)
@@ -417,7 +419,7 @@ void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space)
size = to-entry->pos;
entry->pos = to;
- gui_entry_erase(entry, size);
+ gui_entry_erase(entry, size, TRUE);
}
void gui_entry_transpose_chars(GUI_ENTRY_REC *entry)