                         KEYBOARD HANDLING


[[[[
Unfinished business and uncertainty, January 2004:
  (a) ALT key on Windows does not activate ALT effect. Need to make it
      transmit ESC-x for ALT-x
  (b) Cursor position gets lost on Windows after down-arrow key?
  (c) ALT-n and ALT-p do not seem to enter search mode
  (d) ^C, ^D, ^G, ^O, ^S, ^T, ^Z, ^\ and maybe ^L, ^R interact with
      exceptions or the like so may not be cross-platform yet.
  (e) The intent is clearly thet ^S, ^Q, ^O are recognised whether there
      is an input request or not. I do not do that yet. Maybe Windows
      will need a separate thread always checking the keyboard?
  (f) ALT-e etc do not yet link to the CSL-specific menus
  (g) this code needs to link into my Window system "fwin".
]]]]

Key-bindings that I hope to make work in both terminal and windowed mode,
on both Unix/Linux, Microsoft Windows and the Macintosh.

Note that ALT can be achieved either by holding the ALT key at the
same time as the listed key, or by pressing ESC before the key.

ALT takes priority over SHIFT, and Control takes priority over ALT so
that a character is only treated as having one attribute. If it has none
it just inserts itself.

Where I put a "-" in this table it means that I do not define the meaning
of the keystroke. In the short term at least that will either cause the
keystroke to be ignored, inserted, or treated the same way as the
corresponding character without Control or ALT. In the longer term I may
assign behaviours to some of those keys. I also want to reserve the
possibility of making keys with both Control and ALT have yet different
effects.

Key   Control              ALT

 @    Set Mark             -                    (also Home key)
 A    To beginning         -                    
 B    Back char            Back word            (also left arrow key)
 C    ^C interrupt         Capitalise word      
 D    Delete forward       Delete word          (also the Delete key)
      Also ^D before any other input on a line sends EOF
 E    To end               [Edit menu]          (also End key, ALT ignored)
 F    Forward char         Foward word          (also right arrow key)
 G    ^G interrupt         -                    

 H    Delete back          Del word back        
 I    TAB                  [File menu]          (also TAB key, ALT ignored)
 J    Newline              -                    
 K    Kill line            -                    
 L    Clear screen         Lowercase word       
 M    Newline              [Module load menu]   
 N    Next history         Search history next  (also down arrow key)
 O    Discard output       [Font menu]          

 P    Previous history     Search history prev  (also up arrow key)
 Q    Resume output        -                    
 R    Redisplay            [Break menu]         
 S    Stop output          [Switch menu]        
 T    Transpose chars      -                    
 U    Kill line            Uppercase word       
 V    Quoted insert        -                    
 W    -                    Copy region          

 X    eXtended command     Obey command         
 Y    Yank (=Paste)        -                    
 Z    Pause execution      -                    
 [    =ESC                 -                    
 \    Quit                 -                    
 ]    -                    -                    
 _    -                    -                    
 ^    -                    -                    


The items shown as menus behave as follows:

 ALT-E C cut
       O copy
       P paste
       R reinput
       A select all
       L clear
       D redraw
       H home
       E end
 ALT-I R read
       S save
       L save selected text
       P print
       N print selected text
       X exit
 ALT-M   &Module menu shortcut - load a REDUCE module
 ALT-O F select new font
       R reset to default font
       W reset font and window to default
 Alt-R C as ^C, interrupt current computation
       G as ^G, interrupt & backtrace current computation
       X as ^Z, pause current computation
 ALT-S   &Switch menu shortcut - flip a REDUCE switch


=============================================================================
