Added a key shortcut to jump to command window. - sam - An updated version of the sam text editor.
 (HTM) git clone git://vernunftzentrum.de/sam.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit cdbdf04093a76cd3634e59e127bfd8f7a5083b20
 (DIR) parent 9b3963901ed82c25a563918540e35ac55e8dc1be
 (HTM) Author: Rob King <jking@deadpixi.com>
       Date:   Sun,  1 May 2016 01:27:43 -0500
       
       Added a key shortcut to jump to command window.
       
       Control-K now jumps to the command window, and back to the
       previously-selected window.
       
       Diffstat:
         doc/sam.1                           |       1 +
         samterm/main.c                      |      20 ++++++++++++++++----
       
       2 files changed, 17 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/doc/sam.1 b/doc/sam.1
       @@ -727,6 +727,7 @@ Escape selects
        .Pq "sets dot to"
        everything typed since the last mouse hit.
        Control-S, Control-D, Control-E, and Control-X collapse the selection and the move it one character to the left or right (Control-S and Control-D) or one line up or down (Control-E and Control-X).
       +Control-K alternates focus between the command window and the last file window, making it easy to jump to the command window and back.
        .Pp
        Button 1 changes the selection.
        Pointing to a non-current window with button 1 makes it current; within the current window, button 1 selects text, thus setting dot.
 (DIR) diff --git a/samterm/main.c b/samterm/main.c
       @@ -1,4 +1,4 @@
       -/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
       +//* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
        #include <u.h>
        #include <libc.h>
        #include <libg.h>
       @@ -13,6 +13,7 @@ Cursor        *cursor;
        extern Bitmap        screen;
        Mouse        mouse;
        Flayer        *which = 0;
       +Flayer  *flast = 0;
        Flayer        *work = 0;
        long        snarflen;
        long        typestart = -1;
       @@ -196,6 +197,8 @@ closeup(Flayer *l)
                        which = 0;
                        current(flwhich(Pt(0, 0)));
                }
       +        if(l == flast)
       +                flast = 0;
                if(l == work)
                        work = 0;
                if(--t->nwin == 0){
       @@ -467,6 +470,7 @@ flushtyping(int clearesc)
        #define SCROLLKEY        0x80
        #define UPKEY                0x81
        #define ESC                0x1B
       +#define COMMANDKEY        0x0B
        
        void
        type(Flayer *l, int res)        /* what a bloody mess this is */
       @@ -481,10 +485,10 @@ type(Flayer *l, int res)        /* what a bloody mess this is */
                scrollkey = 0;
                upkey = 0;
                if(res == RKeyboard) {
       -        int pc = qpeekc();
       +                int pc = qpeekc();
                        scrollkey = pc==SCROLLKEY;        /* ICK */
                        upkey = pc == UPKEY;
       -        movekey = (pc == CHARLEFT || pc == CHARRIGHT || pc == LINEUP || pc == LINEDOWN);
       +                movekey = (pc == CHARLEFT || pc == CHARRIGHT || pc == LINEUP || pc == LINEDOWN);
                }
        
                if(lock || t->lock){
       @@ -501,7 +505,7 @@ type(Flayer *l, int res)        /* what a bloody mess this is */
                moving = 0;
                while((c = kbdchar())>0){
                        if(res == RKeyboard){
       -                        if(c == UPKEY || c==SCROLLKEY || c==ESC)
       +                        if(c == UPKEY || c==SCROLLKEY || c==ESC || c==COMMANDKEY)
                                        break;
        
                                /* ctrl-s, ctrl-e, ctrl-d, ctrl-x */
       @@ -657,6 +661,14 @@ type(Flayer *l, int res)        /* what a bloody mess this is */
                                        }
                                }
                        }
       +        }else if(c==COMMANDKEY){
       +                if(which == &cmd.l[0]){
       +                        if (flast)
       +                                current(flast);
       +                }else{
       +                        flast = which;
       +                        current(&cmd.l[0]);
       +                }
                }else{
                        if(c==ESC && typeesc>=0){
                                l->p0 = typeesc;