1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Move code to insert paste prompt into its own function.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4669 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2008-01-21 10:50:50 +00:00 committed by exg
parent 7d30a05879
commit f7856f2071

View File

@ -338,10 +338,28 @@ static void paste_flush(int send)
gui_entry_redraw(active_entry); gui_entry_redraw(active_entry);
} }
static void insert_paste_prompt(void)
{
char *str;
paste_prompt = TRUE;
paste_old_prompt = g_strdup(active_entry->prompt);
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
TXT_PASTE_WARNING,
paste_line_count,
active_win->active == NULL ? "window" :
active_win->active->visible_name);
str = format_get_text(MODULE_NAME, active_win, NULL, NULL,
TXT_PASTE_PROMPT, 0, 0);
gui_entry_set_prompt(active_entry, str);
gui_entry_set_text(active_entry, "");
g_free(str);
}
static gboolean paste_timeout(gpointer data) static gboolean paste_timeout(gpointer data)
{ {
GTimeVal now; GTimeVal now;
char *str;
int diff; int diff;
if (paste_state == 0) { if (paste_state == 0) {
@ -363,19 +381,7 @@ static gboolean paste_timeout(gpointer data)
/* paste without asking */ /* paste without asking */
paste_flush(TRUE); paste_flush(TRUE);
} else if (!paste_prompt) { } else if (!paste_prompt) {
paste_prompt = TRUE; insert_paste_prompt();
paste_old_prompt = g_strdup(active_entry->prompt);
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
TXT_PASTE_WARNING,
paste_line_count,
active_win->active == NULL ? "window" :
active_win->active->visible_name);
str = format_get_text(MODULE_NAME, active_win, NULL, NULL,
TXT_PASTE_PROMPT, 0, 0);
gui_entry_set_prompt(active_entry, str);
gui_entry_set_text(active_entry, "");
g_free(str);
} }
return TRUE; return TRUE;
} }