From 9fc4418912087ab219f6253a57084e34c05bd547 Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 1 Oct 2021 17:15:15 -0400 Subject: [PATCH] [automaton] match follow for mouse events --- src/lib/automaton.c | 3 --- src/lib/in.c | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/lib/automaton.c b/src/lib/automaton.c index a5823d8f8..bcb80bfc8 100644 --- a/src/lib/automaton.c +++ b/src/lib/automaton.c @@ -113,7 +113,6 @@ esctrie_make_numeric(esctrie* e){ for(int i = '0' ; i < '9' ; ++i){ e->trie[i] = e; } - logdebug("made numeric: %p\n", e); return 0; } @@ -130,7 +129,6 @@ esctrie_make_kleene(esctrie* e, unsigned follow, esctrie* term){ e->trie[i] = e; } } - logdebug("made kleene: %p\n", e); return 0; } @@ -146,7 +144,6 @@ esctrie_make_function(esctrie* e, triefunc fxn){ } e->ntype = NODE_FUNCTION; e->fxn = fxn; - logdebug("made function %p: %p\n", fxn, e); return 0; } diff --git a/src/lib/in.c b/src/lib/in.c index ecd4921cc..e9e09f450 100644 --- a/src/lib/in.c +++ b/src/lib/in.c @@ -358,10 +358,10 @@ amata_next_string(automaton* amata, const char* prefix){ // SGR (1006) mouse encoding, so use the final character to determine release // ('M' for click, 'm' for release). static void -mouse_click(inputctx* ictx, unsigned release){ +mouse_click(inputctx* ictx, unsigned release, char follow){ unsigned mods = amata_next_numeric(&ictx->amata, "\x1b[<", ';'); 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); y -= (1 + ictx->tmargin); // convert from 1- to 0-indexing, and account for margins @@ -405,13 +405,13 @@ mouse_click(inputctx* ictx, unsigned release){ static int mouse_press_cb(inputctx* ictx){ - mouse_click(ictx, 0); + mouse_click(ictx, 0, 'M'); return 2; } static int mouse_release_cb(inputctx* ictx){ - mouse_click(ictx, 1); + mouse_click(ictx, 1, 'm'); return 2; }