From 58c840dcc1810bfc5a7334fe29058d2b2c97cdaf Mon Sep 17 00:00:00 2001 From: jacob Date: Sun, 18 Feb 2007 14:02:39 +0000 Subject: [PATCH] Ctrl-Break now sends a Break signal (previously it was equivalent to Ctrl-C). git-svn-id: svn://svn.tartarus.org/sgt/putty@7295 cda61777-01e9-0310-a592-d414129be87e --- doc/using.but | 3 +++ unix/gtkwin.c | 9 ++++----- windows/window.c | 11 ++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/doc/using.but b/doc/using.but index 17fdce5f..adf5ee9a 100644 --- a/doc/using.but +++ b/doc/using.but @@ -128,6 +128,9 @@ connection in addition to normal data. Their precise effect is usually up to the server. Currently only Telnet, SSH, and serial connections have special commands. +The \q{break} signal can also be invoked from the keyboard with +\i{Ctrl-Break}. + The following \I{Telnet special commands}special commands are available in Telnet: diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 816211a5..03ecc35a 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -663,13 +663,12 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) end = 2; } - /* Control-Break is the same as Control-C */ + /* Control-Break sends a Break special to the backend */ if (event->keyval == GDK_Break && (event->state & GDK_CONTROL_MASK)) { - output[1] = '\003'; - use_ucsoutput = FALSE; - end = 2; - special = TRUE; + if (inst->back) + inst->back->special(inst->backhandle, TS_BRK); + return TRUE; } /* We handle Return ourselves, because it needs to be flagged as diff --git a/windows/window.c b/windows/window.c index ceeaa767..f654d2ad 100644 --- a/windows/window.c +++ b/windows/window.c @@ -3566,8 +3566,9 @@ int char_width(Context ctx, int uc) { /* * Translate a WM_(SYS)?KEY(UP|DOWN) message into a string of ASCII - * codes. Returns number of bytes used or zero to drop the message - * or -1 to forward the message to windows. + * codes. Returns number of bytes used, zero to drop the message, + * -1 to forward the message to Windows, or another negative number + * to indicate a NUL-terminated "special" string. */ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, unsigned char *output) @@ -3987,9 +3988,9 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, return p - output; } if (wParam == VK_CANCEL && shift_state == 2) { /* Ctrl-Break */ - *p++ = 3; - *p++ = 0; - return -2; + if (back) + back->special(backhandle, TS_BRK); + return 0; } if (wParam == VK_PAUSE) { /* Break/Pause */ *p++ = 26; -- 2.11.0