]> git.neil.brown.name Git - edlib.git/commitdiff
ncurses: catch and ignore focus-in/out
authorNeilBrown <neil@brown.name>
Wed, 9 Aug 2023 00:52:17 +0000 (10:52 +1000)
committerNeilBrown <neil@brown.name>
Fri, 11 Aug 2023 04:36:35 +0000 (14:36 +1000)
focus-in/out comes in as unknown key at awkward times causing problems
for C-l and the refresh causes a focus-out.
So catch and ignore for now.
Also log any unrecognised keys so I can try to handle them.

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
display-ncurses.c

index 143a58999a5c3420d7824d3871992b4e824281ce..a3e1a6a0161ac12c5dbd51760ade82e57ee6f50a 100644 (file)
@@ -11,6 +11,7 @@ the file.
 
 - [ ] find a better wat to handle "case when EOF is at the end" of
       a non-empty line.
+- [ ] input uses 0 for Efallthrough!
 - [X] call, not caLl in server.py
 - [X] lib-server received unexpected notification Close
 - [ ] should pane ->cx,cy be a struct xy??
@@ -158,6 +159,8 @@ Core features
 - [ ] teach input to allow a repeat command to be registered so that e.g.
       search/replace and do a bit of work, then ask to be called again.
       input can cancel this on suitable input.
+- [ ] should input leave mode unchanged for key that isn't handled at
+      all
 - [ ] marks can be used after they go invalid too easily.  How to fix??
 - [ ] catching doc:replace in a pane doesn't catch doc:insert-file.
       I need a simple way to intercept any change.
@@ -355,6 +358,7 @@ Module features
 
 ### ncurses
 
+- [ ] What to do with Focus-in/out keys?
 - [ ] add full list of colour names (to lib-colourmap)
 - [ ] allow a pane to require 'true-colour' and discover number of colours available
       Colour map gets changed when it becomes the focus.
index 64d6408414880461a253e6a6e1aaf99f35d8c473..8e7436f415ce12ace8bda234b238fd74b63a4cc4 100644 (file)
@@ -1527,6 +1527,8 @@ static struct namelist {
        { 00436, ":S:F10"},
        { 00437, ":S:F11"},
        { 00440, ":S:F12"},
+       { 01114, ":Focus-in"},
+       { 01115, ":Focus-out"},
        {0, NULL}
 }, char_names[] = {
        {'\e', ":ESC"},
@@ -1557,8 +1559,11 @@ static void send_key(int keytype, wint_t c, int alt, struct pane *p safe)
 
        if (keytype == KEY_CODE_YES) {
                n = find_name(key_names, c);
-               if (!n)
+               if (!n) {
+                       LOG("Unknown ncurses key 0o%o", c);
                        sprintf(buf, "%sNcurs-%o", a, c);
+               } else if (strstarts(n, ":Focus-"))
+                       /* Ignore focus changes for now */;
                else
                        strcat(strcpy(buf, a), n);
        } else {