[automaton] match follow for mouse events

pull/2224/head
nick black 3 years ago committed by nick black
parent 49365e2d22
commit 9fc4418912

@ -113,7 +113,6 @@ esctrie_make_numeric(esctrie* e){
for(int i = '0' ; i < '9' ; ++i){ for(int i = '0' ; i < '9' ; ++i){
e->trie[i] = e; e->trie[i] = e;
} }
logdebug("made numeric: %p\n", e);
return 0; return 0;
} }
@ -130,7 +129,6 @@ esctrie_make_kleene(esctrie* e, unsigned follow, esctrie* term){
e->trie[i] = e; e->trie[i] = e;
} }
} }
logdebug("made kleene: %p\n", e);
return 0; return 0;
} }
@ -146,7 +144,6 @@ esctrie_make_function(esctrie* e, triefunc fxn){
} }
e->ntype = NODE_FUNCTION; e->ntype = NODE_FUNCTION;
e->fxn = fxn; e->fxn = fxn;
logdebug("made function %p: %p\n", fxn, e);
return 0; return 0;
} }

@ -358,10 +358,10 @@ amata_next_string(automaton* amata, const char* prefix){
// SGR (1006) mouse encoding, so use the final character to determine release // SGR (1006) mouse encoding, so use the final character to determine release
// ('M' for click, 'm' for release). // ('M' for click, 'm' for release).
static void static void
mouse_click(inputctx* ictx, unsigned release){ mouse_click(inputctx* ictx, unsigned release, char follow){
unsigned mods = amata_next_numeric(&ictx->amata, "\x1b[<", ';'); unsigned mods = amata_next_numeric(&ictx->amata, "\x1b[<", ';');
long x = amata_next_numeric(&ictx->amata, "", ';'); long x = amata_next_numeric(&ictx->amata, "", ';');
long y = amata_next_numeric(&ictx->amata, "", ';'); long y = amata_next_numeric(&ictx->amata, "", follow);
x -= (1 + ictx->lmargin); x -= (1 + ictx->lmargin);
y -= (1 + ictx->tmargin); y -= (1 + ictx->tmargin);
// convert from 1- to 0-indexing, and account for margins // convert from 1- to 0-indexing, and account for margins
@ -405,13 +405,13 @@ mouse_click(inputctx* ictx, unsigned release){
static int static int
mouse_press_cb(inputctx* ictx){ mouse_press_cb(inputctx* ictx){
mouse_click(ictx, 0); mouse_click(ictx, 0, 'M');
return 2; return 2;
} }
static int static int
mouse_release_cb(inputctx* ictx){ mouse_release_cb(inputctx* ictx){
mouse_click(ictx, 1); mouse_click(ictx, 1, 'm');
return 2; return 2;
} }

Loading…
Cancel
Save