core: flush stdout/stderr after sending text directly on them (fix corrupted data sent to hook_process() callback) (closes #442)

This commit is contained in:
Sébastien Helleu 2015-07-25 09:16:08 +02:00
parent b99a630705
commit 7572fec261
7 changed files with 18 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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);
}
/*

View File

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

View File

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