summaryrefslogtreecommitdiff
path: root/src/gui/curses/gui-curses-key.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/curses/gui-curses-key.c')
-rw-r--r--src/gui/curses/gui-curses-key.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c
index 7c07ffd3e..4fb0f6fc3 100644
--- a/src/gui/curses/gui-curses-key.c
+++ b/src/gui/curses/gui-curses-key.c
@@ -296,13 +296,11 @@ gui_key_flush (int paste)
key = gui_key_buffer[i];
/*
- * Many terminal emulators sends \n as \r when pasting, so replace them
- * back
+ * many terminal emulators send "\n" as "\r" when pasting, so replace
+ * them back
*/
- if (paste && key == '\r')
- {
+ if (paste && (key == '\r'))
key = '\n';
- }
insert_ok = 1;
utf_partial_char[0] = '\0';
@@ -314,7 +312,7 @@ gui_key_flush (int paste)
key_str[1] = '\0';
length_key_str = 1;
}
- else if (!paste && key < 32)
+ else if (!paste && (key < 32))
{
insert_ok = 0;
key_str[0] = '\x01';
@@ -329,7 +327,7 @@ gui_key_flush (int paste)
key_str[2] = '\0';
length_key_str = 2;
}
- else if (!paste && key == 127)
+ else if (!paste && (key == 127))
{
insert_ok = 0;
key_str[0] = '\x01';
@@ -389,7 +387,9 @@ gui_key_flush (int paste)
* or if the mouse code is valid UTF-8 (do not send partial mouse
* code which is not UTF-8 valid)
*/
- if (!paste && (!gui_mouse_event_pending || utf8_is_valid (key_str, -1, NULL)))
+ if (!paste
+ && (!gui_mouse_event_pending
+ || utf8_is_valid (key_str, -1, NULL)))
{
(void) hook_signal_send ("key_pressed",
WEECHAT_HOOK_SIGNAL_STRING, key_str);
@@ -402,8 +402,9 @@ gui_key_flush (int paste)
input_old = NULL;
old_buffer = gui_current_window->buffer;
- if ((paste || gui_key_pressed (key_str) != 0) && (insert_ok)
- && (!gui_cursor_mode))
+ if ((paste || gui_key_pressed (key_str) != 0)
+ && insert_ok
+ && !gui_cursor_mode)
{
if (!paste || !undo_done)
gui_buffer_undo_snap (gui_current_window->buffer);