core: convert tabs to spaces in text pasted (bug #25028)

This commit is contained in:
Sebastien Helleu 2012-03-24 13:22:41 +01:00
parent b7d75cf455
commit b867c69477
4 changed files with 22 additions and 0 deletions

View File

@ -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)

View File

@ -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 ();

View File

@ -1480,6 +1480,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 ();
}

View File

@ -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);