diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-03-24 13:22:41 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-03-24 13:22:41 +0100 |
commit | b867c69477cf292d6cc88abe8741be475adc5120 (patch) | |
tree | 8c2e4f13abc6311ae9bc9a501d174a24b6651476 | |
parent | b7d75cf45518cb497bf5450ad40eee9dc961c345 (diff) | |
download | weechat-b867c69477cf292d6cc88abe8741be475adc5120.zip |
core: convert tabs to spaces in text pasted (bug #25028)
-rw-r--r-- | ChangeLog | 1 | ||||
-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 |
4 files changed, 22 insertions, 0 deletions
@@ -7,6 +7,7 @@ v0.3.8-dev, 2012-03-24 Version 0.3.8 (under dev!) -------------------------- +* core: convert tabs to spaces in text pasted (bug #25028) * core: add a connection timeout for child process in hook_connect (bug #35966) * core: follow symbolic links when writing configuration files (.conf) (task #11779) 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); |