summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.asciidoc2
-rw-r--r--src/core/wee-command.c2
-rw-r--r--src/gui/curses/gui-curses-key.c5
-rw-r--r--src/gui/curses/gui-curses-mouse.c2
-rw-r--r--src/gui/curses/gui-curses-window.c2
-rw-r--r--src/gui/gui-completion.c5
-rw-r--r--src/gui/gui-window.c3
7 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc
index 79af845ce..4b0cfb4bb 100644
--- a/ChangeLog.asciidoc
+++ b/ChangeLog.asciidoc
@@ -40,6 +40,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
=== Bugs fixed
+* core: flush stdout/stderr after sending text directly on them
+ (fix corrupted data sent to hook_process() callback) (issue #442)
* core: allow execution of command "/input return" on a buffer which is not
displayed in a window
* core: allow jump from current to previous buffer with default keys
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 215abee75..ef1ce1db1 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -4607,6 +4607,7 @@ COMMAND_CALLBACK(print)
else if (string_strcasecmp (argv[i], "-beep") == 0)
{
fprintf (stderr, "\a");
+ fflush (stderr);
return WEECHAT_RC_OK;
}
else if (argv[i][0] == '-')
@@ -4632,6 +4633,7 @@ COMMAND_CALLBACK(print)
if (text)
{
fprintf ((to_stdout) ? stdout : stderr, "%s", text);
+ fflush ((to_stdout) ? stdout : stderr);
free (text);
}
}
diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c
index b2c8f43be..30705f0d1 100644
--- a/src/gui/curses/gui-curses-key.c
+++ b/src/gui/curses/gui-curses-key.c
@@ -465,7 +465,10 @@ gui_key_flush (int paste)
* found
*/
if (CONFIG_BOOLEAN(config_look_search_text_not_found_alert))
- printf ("\a");
+ {
+ fprintf (stderr, "\a");
+ fflush (stderr);
+ }
}
else
{
diff --git a/src/gui/curses/gui-curses-mouse.c b/src/gui/curses/gui-curses-mouse.c
index a1a186bfc..16330a76e 100644
--- a/src/gui/curses/gui-curses-mouse.c
+++ b/src/gui/curses/gui-curses-mouse.c
@@ -89,6 +89,7 @@ gui_mouse_enable ()
{
gui_mouse_enabled = 1;
fprintf (stderr, "\033[?1005h\033[?1000h\033[?1002h");
+ fflush (stderr);
(void) hook_signal_send ("mouse_enabled",
WEECHAT_HOOK_SIGNAL_STRING, NULL);
@@ -103,6 +104,7 @@ gui_mouse_disable ()
{
gui_mouse_enabled = 0;
fprintf (stderr, "\033[?1002l\033[?1000l\033[?1005l");
+ fflush (stderr);
(void) hook_signal_send ("mouse_disabled",
WEECHAT_HOOK_SIGNAL_STRING, NULL);
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index a758383c9..af0a69c91 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -2521,6 +2521,7 @@ gui_window_send_clipboard (const char *storage_unit, const char *text)
fprintf (stderr, "\033]52;%s;%s\a",
(storage_unit) ? storage_unit : "",
text_base64);
+ fflush (stderr);
free (text_base64);
}
}
@@ -2545,6 +2546,7 @@ gui_window_set_bracketed_paste_mode (int enable)
(screen) ? "\033P" : "",
(enable) ? "h" : "l",
(screen) ? "\033\\" : "");
+ fflush (stderr);
}
/*
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index c371c39ca..0e07b96da 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -1157,7 +1157,10 @@ gui_completion_complete (struct t_gui_completion *completion)
/* alert user of partial completion */
if (CONFIG_BOOLEAN(config_completion_partial_completion_alert))
- printf ("\a");
+ {
+ fprintf (stderr, "\a");
+ fflush (stderr);
+ }
/*
* send "partial_completion" signal, to display possible
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index 32ad5fe9c..b055f2262 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -1639,7 +1639,8 @@ gui_window_search_restart (struct t_gui_window *window)
if (CONFIG_BOOLEAN(config_look_search_text_not_found_alert)
&& window->buffer->input_buffer && window->buffer->input_buffer[0])
{
- printf ("\a");
+ fprintf (stderr, "\a");
+ fflush (stderr);
}
gui_buffer_ask_chat_refresh (window->buffer, 2);
}