]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
chat: enable CTRL+q to push to history, make ESCAPE do the same
authornyov <nyov@nexnode.net>
Mon, 12 Mar 2012 10:55:14 +0000 (11:55 +0100)
committernyov <nyov@nexnode.net>
Mon, 12 Mar 2012 10:55:14 +0000 (11:55 +0100)
keys.c

diff --git a/keys.c b/keys.c
index 9b6704c866ac0d1232a35f0358de4bf9b20c36d5..8108c2a68e1f746e0b1f1a123676d3d675fa4009 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -1463,6 +1463,16 @@ Key_Message (int key, int unicode)
                        return;
                }
 
+               if (key == 'q' && keydown[K_CTRL]) // like zsh ^q: push line to history, don't execute, and clear
+               {
+                       // clear line
+                       MsgKey_History_Push();
+                       // key_dest = key_game; //but don't close input, ESC does that
+                       chat_bufferpos = 0;
+                       chat_buffer[0] = 0;
+                       return;
+               }
+
                if (key == K_ENTER || unicode == /* LF */ 10 || unicode == /* CR */ 13)
                {
                        if(chat_mode < 0)
@@ -1480,6 +1490,7 @@ Key_Message (int key, int unicode)
                }
 
                if (key == K_ESCAPE) {
+                       MsgKey_History_Push();
                        key_dest = key_game;
                        chat_bufferpos = 0;
                        chat_buffer[0] = 0;