summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/gui/curses/gui-curses-key.c3
-rw-r--r--src/gui/gui-key.c17
-rw-r--r--src/gui/gui-key.h1
4 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b1ec5a479..8ec030537 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);