From 6c45a087bf190e06c0ffab3abdd181a5eaa49785 Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 2 Oct 2021 01:24:21 -0400 Subject: [PATCH] build cflow following special keys #2222 --- src/lib/automaton.c | 9 ++++++++- src/lib/in.c | 4 ++-- src/lib/termdesc.c | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lib/automaton.c b/src/lib/automaton.c index 8fe9976a1..4563fde5f 100644 --- a/src/lib/automaton.c +++ b/src/lib/automaton.c @@ -265,11 +265,16 @@ link_numeric(automaton* a, esctrie* e, unsigned follow){ if((efollow = esctrie_from_idx(a, create_esctrie_node(a, 0))) == NULL){ return NULL; } + logdebug("EFOLLOW: %u\n", esctrie_idx(a, efollow)); } for(int i = '0' ; i <= '9' ; ++i){ if(e->trie[i] == 0){ e->trie[i] = esctrie_idx(a, targ); + }else{ + logdebug("SKIPPING[%d] %u\n", i, e->trie[i]); } + } + for(int i = '0' ; i <= '9' ; ++i){ fill_in_numerics(a, esctrie_from_idx(a, e->trie[i]), targ, follow, efollow); } return efollow; @@ -305,6 +310,7 @@ insert_path(automaton* a, const char* seq){ return NULL; } }else if(c == 'S'){ + // strings always end with ST ("\e\\") if((eptr = esctrie_make_string(a, eptr)) == NULL){ return NULL; } @@ -326,7 +332,6 @@ insert_path(automaton* a, const char* seq){ } inescape = false; }else{ // fixed character - logtrace("adding fixed %c %u\n", c, c); if(eptr->trie[c] == 0){ if((eptr->trie[c] = create_esctrie_node(a, 0)) == 0){ return NULL; @@ -348,6 +353,7 @@ insert_path(automaton* a, const char* seq){ eptr->trie[c] = esctrie_idx(a, newe); } eptr = esctrie_from_idx(a, eptr->trie[c]); + logtrace("added fixed %c %u as %u\n", c, c, esctrie_idx(a, eptr)); } } if(inescape){ @@ -392,6 +398,7 @@ int inputctx_add_input_escape(automaton* a, const char* esc, uint32_t special, eptr->ni.alt = alt; eptr->ni.y = 0; eptr->ni.x = 0; + logdebug("added 0x%08x to %u\n", special, esctrie_idx(a, eptr)); } return 0; } diff --git a/src/lib/in.c b/src/lib/in.c index 59a855a98..32622de4c 100644 --- a/src/lib/in.c +++ b/src/lib/in.c @@ -1582,10 +1582,10 @@ read_inputs_nblock(inputctx* ictx){ static void* input_thread(void* vmarshall){ inputctx* ictx = vmarshall; - if(build_cflow_automaton(ictx)){ + if(prep_all_keys(ictx)){ abort(); // FIXME? } - if(prep_all_keys(ictx)){ + if(build_cflow_automaton(ictx)){ abort(); // FIXME? } for(;;){ diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index 1671d496c..d6ed8a591 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -318,6 +318,7 @@ init_terminfo_esc(tinfo* ti, const char* name, escape_e idx, // request kitty keyboard protocol through level 1, first pushing current. // see https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement +// FIXME go to level 3, but need handle release codes #define KBDSUPPORT "\x1b[>u\x1b[=1u" // the kitty keyboard protocol allows unambiguous, complete identification of