1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-22 04:35:58 -04:00

Ctrl-W deletes word in left - patch from

Kjetil �degaard <kjetilod@orakel.ntnu.no>


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@341 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-14 18:02:13 +00:00 committed by cras
parent 22b12d85ee
commit 72b32ff175
3 changed files with 31 additions and 0 deletions

View File

@ -149,6 +149,30 @@ void gui_entry_erase(int size)
entry_update();
}
void gui_entry_erase_word(void)
{
int to;
if (pos == 0) return;
to = pos - 1;
while (entry->str[to] == ' ' && to > 0)
to--;
while (entry->str[to] != ' ' && to > 0)
to--;
if (entry->str[to] == ' ' && to > 0)
to++;
g_string_erase(entry, to, pos - to);
pos = to;
entry_screenpos();
entry_update();
}
int gui_entry_get_pos(void)
{
return pos;

View File

@ -12,7 +12,9 @@ char *gui_entry_get_text(void);
void gui_entry_insert_text(const char *str);
void gui_entry_insert_char(char chr);
void gui_entry_erase(int size);
void gui_entry_erase_word(void);
int gui_entry_get_pos(void);
void gui_entry_set_pos(int pos);

View File

@ -208,6 +208,11 @@ void handle_key(int key)
gui_entry_erase(1);
break;
case 23:
/* C-w - erase word to the left of marker */
gui_entry_erase_word();
break;
case 4:
case KEY_DC:
if (gui_entry_get_pos() < strlen(gui_entry_get_text())) {