summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2008-01-21 10:50:50 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2008-01-21 10:50:50 +0000
commitf7856f207194b94efe26c5e2c9e195a40a50db9b (patch)
tree38c443dfce6b72c3275032cef9b69fc196e0cb9f /src
parent7d30a05879e228ef62e3598122063945be6e816e (diff)
downloadirssi-f7856f207194b94efe26c5e2c9e195a40a50db9b.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/fe-text/gui-readline.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index d7129c98..f3eda41b 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -338,10 +338,28 @@ static void paste_flush(int send)
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)
{
GTimeVal now;
- char *str;
int diff;
if (paste_state == 0) {
@@ -363,19 +381,7 @@ static gboolean paste_timeout(gpointer data)
/* paste without asking */
paste_flush(TRUE);
} else if (!paste_prompt) {
- 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);
+ insert_paste_prompt();
}
return TRUE;
}