tcolar / goed

Terminal based code editor / development environment
MIT License
133 stars 6 forks source link

Select with keyboard : Shift + arrows #47

Closed tcolar closed 9 years ago

tcolar commented 9 years ago

First will need to add support for meta keys to termbox, spec: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-PC-Style-Function-Keys

In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is
false, xterm recognizes function key modifiers which are parameters
appended before the final character of the control sequence.

                    Code     Modifiers
                  ---------+---------------------------
                     2     | Shift
                     3     | Alt
                     4     | Shift + Alt
                     5     | Control
                     6     | Shift + Control
                     7     | Alt + Control
                     8     | Shift + Alt + Control
                     9     | Meta
                     10    | Meta + Shift
                     11    | Meta + Alt
                     12    | Meta + Alt + Shift
                     13    | Meta + Ctrl
                     14    | Meta + Ctrl + Shift
                     15    | Meta + Ctrl + Alt
                     16    | Meta + Ctrl + Alt + Shift
                  ---------+---------------------------

For example, shift-F5 would be sent as CSI 1 5 ; 2 ~

So around https://github.com/tcolar/termbox-go/blob/master/termbox.go#L313 will want to add something along the lines of:

if strings.HasPrefix(bufstr, key[:last) {
  if followed by ';', then followed by a number (meta in ascii digit), then followed by key[last] 
     .... now we have the key and the meat value ......
}
tcolar commented 9 years ago

Done for shift+ l,r,up.down,home,end TBD : shift + PgUp, PgDown

tcolar commented 9 years ago

done