diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/curses/gui-curses-key.c | 3 | ||||
-rw-r--r-- | src/gui/gui-key.c | 17 | ||||
-rw-r--r-- | src/gui/gui-key.h | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c index d9589a498..92393ac9a 100644 --- a/src/gui/curses/gui-curses-key.c +++ b/src/gui/curses/gui-curses-key.c @@ -588,6 +588,9 @@ gui_key_read_cb (void *data, int fd) /* remove final newline (if needed) */ gui_key_paste_remove_newline (); + /* replace tabs by spaces */ + gui_key_paste_replace_tabs (); + /* stop bracketed mode */ gui_key_paste_bracketed_timer_remove (); gui_key_paste_bracketed_stop (); diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index e505e868c..33bad6269 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -1481,6 +1481,22 @@ gui_key_paste_remove_newline () } /* + * gui_key_paste_replace_tabs: replace tabs by spaces in paste + */ + +void +gui_key_paste_replace_tabs () +{ + int i; + + for (i = 0; i < gui_key_buffer_size; i++) + { + if (gui_key_buffer[i] == '\t') + gui_key_buffer[i] = ' '; + } +} + +/* * gui_key_paste_start: start paste of text */ @@ -1488,6 +1504,7 @@ void gui_key_paste_start () { gui_key_paste_remove_newline (); + gui_key_paste_replace_tabs (); gui_key_paste_pending = 1; gui_input_paste_pending_signal (); } diff --git a/src/gui/gui-key.h b/src/gui/gui-key.h index 373d033e5..0ecd32066 100644 --- a/src/gui/gui-key.h +++ b/src/gui/gui-key.h @@ -118,6 +118,7 @@ extern int gui_key_buffer_search (int start_index, int max_index, const char *string); extern void gui_key_buffer_remove (int index, int number); extern void gui_key_paste_remove_newline (); +extern void gui_key_paste_replace_tabs (); extern void gui_key_paste_start (); extern int gui_key_get_paste_lines (); extern int gui_key_paste_check (int bracketed_paste); |