forked from PsychoticNinja/irssi
Simplify sending of the first pasted line.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4912 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
136a1ec360
commit
ca5f4ec1f9
@ -253,16 +253,18 @@ static void paste_send(void)
|
|||||||
HISTORY_REC *history;
|
HISTORY_REC *history;
|
||||||
unichar *arr;
|
unichar *arr;
|
||||||
GString *str;
|
GString *str;
|
||||||
char out[10], *text;
|
char out[10];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (paste_join_multiline)
|
if (paste_join_multiline)
|
||||||
paste_buffer_join_lines(paste_buffer);
|
paste_buffer_join_lines(paste_buffer);
|
||||||
|
|
||||||
arr = (unichar *) paste_buffer->data;
|
arr = (unichar *) paste_buffer->data;
|
||||||
|
str = g_string_new(NULL);
|
||||||
if (active_entry->text_len == 0)
|
if (active_entry->text_len == 0)
|
||||||
i = 0;
|
i = 0;
|
||||||
else {
|
else {
|
||||||
|
g_string_append_len(str, paste_entry, paste_entry_pos);
|
||||||
/* first line has to be kludged kind of to get pasting in the
|
/* first line has to be kludged kind of to get pasting in the
|
||||||
middle of line right.. */
|
middle of line right.. */
|
||||||
for (i = 0; i < paste_buffer->len; i++) {
|
for (i = 0; i < paste_buffer->len; i++) {
|
||||||
@ -271,20 +273,19 @@ static void paste_send(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gui_entry_insert_char(active_entry, arr[i]);
|
g_string_append_c(str, arr[i]);
|
||||||
}
|
}
|
||||||
|
g_string_append(str, paste_entry+paste_entry_pos);
|
||||||
|
|
||||||
text = gui_entry_get_text(active_entry);
|
|
||||||
history = command_history_current(active_win);
|
history = command_history_current(active_win);
|
||||||
command_history_add(history, text);
|
command_history_add(history, str->str);
|
||||||
|
|
||||||
signal_emit("send command", 3, text,
|
signal_emit("send command", 3, str->str,
|
||||||
active_win->active_server, active_win->active);
|
active_win->active_server, active_win->active);
|
||||||
g_free(text);
|
g_string_truncate(str, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rest of the lines */
|
/* rest of the lines */
|
||||||
str = g_string_new(NULL);
|
|
||||||
for (; i < paste_buffer->len; i++) {
|
for (; i < paste_buffer->len; i++) {
|
||||||
if (arr[i] == '\r' || arr[i] == '\n') {
|
if (arr[i] == '\r' || arr[i] == '\n') {
|
||||||
history = command_history_current(active_win);
|
history = command_history_current(active_win);
|
||||||
@ -312,9 +313,6 @@ static void paste_send(void)
|
|||||||
|
|
||||||
static void paste_flush(int send)
|
static void paste_flush(int send)
|
||||||
{
|
{
|
||||||
gui_entry_set_text(active_entry, paste_entry);
|
|
||||||
gui_entry_set_pos(active_entry, paste_entry_pos);
|
|
||||||
|
|
||||||
if (send)
|
if (send)
|
||||||
paste_send();
|
paste_send();
|
||||||
g_array_set_size(paste_buffer, 0);
|
g_array_set_size(paste_buffer, 0);
|
||||||
@ -428,8 +426,6 @@ static int check_pasting(unichar key, int diff)
|
|||||||
|
|
||||||
/* newline - assume this line was pasted */
|
/* newline - assume this line was pasted */
|
||||||
paste_state = 2;
|
paste_state = 2;
|
||||||
gui_entry_set_text(active_entry, paste_entry);
|
|
||||||
gui_entry_set_pos(active_entry, paste_entry_pos);
|
|
||||||
if (paste_verify_line_count > 0)
|
if (paste_verify_line_count > 0)
|
||||||
g_timeout_add(100, paste_timeout, NULL);
|
g_timeout_add(100, paste_timeout, NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user