mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Add function to delete the whole cell under the cursor and use it for
delete_character. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4521 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
ceea629e3e
commit
8a9da9cf2d
@ -561,6 +561,25 @@ void gui_entry_erase(GUI_ENTRY_REC *entry, int size, int update_cutbuffer)
|
||||
gui_entry_draw(entry);
|
||||
}
|
||||
|
||||
void gui_entry_erase_cell(GUI_ENTRY_REC *entry)
|
||||
{
|
||||
int size = 1;
|
||||
|
||||
g_return_if_fail(entry != NULL);
|
||||
|
||||
if (entry->utf8)
|
||||
while (entry->pos+size < entry->text_len &&
|
||||
mk_wcwidth(entry->text[entry->pos+size]) == 0) size++;
|
||||
|
||||
g_memmove(entry->text + entry->pos, entry->text + entry->pos + size,
|
||||
(entry->text_len-entry->pos-size+1) * sizeof(unichar));
|
||||
|
||||
entry->text_len -= size;
|
||||
|
||||
gui_entry_redraw_from(entry, entry->pos);
|
||||
gui_entry_draw(entry);
|
||||
}
|
||||
|
||||
void gui_entry_erase_word(GUI_ENTRY_REC *entry, int to_space)
|
||||
{
|
||||
int to;
|
||||
|
@ -42,6 +42,7 @@ void gui_entry_insert_char(GUI_ENTRY_REC *entry, unichar chr);
|
||||
char *gui_entry_get_cutbuffer(GUI_ENTRY_REC *entry);
|
||||
void gui_entry_erase_to(GUI_ENTRY_REC *entry, int pos, int update_cutbuffer);
|
||||
void gui_entry_erase(GUI_ENTRY_REC *entry, int size, int update_cutbuffer);
|
||||
void gui_entry_erase_cell(GUI_ENTRY_REC *entry);
|
||||
void gui_entry_erase_word(GUI_ENTRY_REC *entry, int to_space);
|
||||
void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space);
|
||||
|
||||
|
@ -697,8 +697,7 @@ static void key_upcase_word(void)
|
||||
static void key_delete_character(void)
|
||||
{
|
||||
if (gui_entry_get_pos(active_entry) < active_entry->text_len) {
|
||||
gui_entry_move_pos(active_entry, 1);
|
||||
gui_entry_erase(active_entry, 1, FALSE);
|
||||
gui_entry_erase_cell(active_entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user