simon-git: putty (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sat Dec 8 16:15:39 GMT 2018


TL;DR:
  41e1a586 Centralise key escape sequences into terminal.c.
  383a16d5 Fix handling of backspace at beginning of line.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2018-12-08 16:15:38

commit 41e1a586fb956539a74bc446984a100e0138cd77
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=41e1a586fb956539a74bc446984a100e0138cd77;hp=50b9448450b924d71b6637daa5de3351d283effb
Author: Simon Tatham <anakin at pobox.com>
Date:   Sat Dec 8 08:25:32 2018 +0000

    Centralise key escape sequences into terminal.c.
    
    A long time ago, in commit 4d77b6567, I moved the generation of the
    arrow-key escape sequences into a function format_arrow_key(). Mostly
    the reason for that was a special purpose I had in mind at the time
    which involved auto-generating the same sequences in response to
    things other than a keypress, but I always thought it would be nice to
    centralise a lot more of PuTTY's complicated keyboard handling in the
    same way - at least the handling of the function keys and their
    numerous static and dynamic config options.
    
    In this year's general spirit of tidying up and refactoring, I think
    it's finally time. So here I introduce three more centralised
    functions for dealing with the numbered function keys, the small
    keypad (Ins, Home, PgUp etc) and the numeric keypad. Lots of horrible
    and duplicated code from the key handling functions in window.c and
    gtkwin.c is now more sensibly centralised: each platform keyboard
    handler concerns itself with the local format of a keyboard event and
    platform-specific enumeration of key codes, and once it's decided what
    the logical key press actually _is_, it hands off to the new functions
    in terminal.c to generate the appropriate escape code.
    
    Mostly this is intended to be a refactoring without functional change,
    leaving the keyboard handling how it's always been. But in cases where
    the Windows and GTK handlers were accidentally inconsistent, I've
    fixed the inconsistency rather than carefully keeping both sides how
    they were. Known consistency fixes:
    
     - swapping the arrow keys between normal (ESC [ A) and application
       (ESC O A) is now done by pressing Ctrl with them, and _not_ by
       pressing Shift. That was how it was always supposed to work, and
       how it's worked on GTK all along, but on Windows it's been done by
       Shift as well since 2010, due to a bug at the call site of
       format_arrow_key() introduced when I originally wrote that function.
    
     - in Xterm function key mode plus application keypad mode, the /*-
       keys on the numeric keypad now send ESC O {o,j,m} in place of ESC O
       {Q,R,S}. That's how the Windows keyboard handler has worked all
       along (it was a deliberate behaviour tweak for the Xterm-like
       function key mode, because in that mode ESC O {Q,R,S} are generated
       by F2-F4). But the GTK keyboard handler omitted that particular
       special case and was still sending ESC O {Q,R,S} for those keys in
       all application keypad modes.
    
     - also in Xterm function key mode plus app keypad mode, we only
       generates the app-keypad escape sequences if Num Lock is on; with
       Num Lock off, the numeric keypad becomes arrow keys and
       Home/End/etc, just as it would in non-app-keypad mode. Windows has
       done this all along, but again, GTK lacked that special case.

 putty.h          |   8 +
 terminal.c       | 183 +++++++++++++++++++-
 unix/gtkwin.c    | 495 ++++++++++++++-----------------------------------------
 windows/window.c | 425 ++++++++++-------------------------------------
 4 files changed, 401 insertions(+), 710 deletions(-)

commit 383a16d5e54ae2563e630511a6e275833c4dfcc0
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=383a16d5e54ae2563e630511a6e275833c4dfcc0;hp=41e1a586fb956539a74bc446984a100e0138cd77
Author: Simon Tatham <anakin at pobox.com>
Date:   Sat Dec 8 16:12:05 2018 +0000

    Fix handling of backspace at beginning of line.
    
    In the big boolification commit (3214563d8) I accidentally rewrote
    "term->wrap == 0" as "term->wrap" instead of as "!term->wrap", so now
    sending the backspace character to the terminal at the start of a line
    causes the cursor to wrap round to the end of the previous line if and
    only if it _shouldn't_ have done.

 terminal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



More information about the tartarus-commits mailing list