vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit fe62893d64e05062e33ff21e30c7a815fb01e37d parent 0a6f215e6c1b5458e247a51e274cb3834091f006 Author: Marc André Tanner <mat@brain-dump.org> Date: Sat, 14 Nov 2020 08:48:28 +0100 vis: fix <C-c> processing after SIGINT There are two main ways how the input queue is managed in vis: - vis_keys_feed(..) appends new input to the queue and immediately starts processing it. Starting from the position before the call i.e. ignoring any previously queued input. This is typically used in key binding handlers where the input queue still contains the mapping leading to the invocation of the handler. In that case new input should be interpreted immediately, before the handler eventually returns and its mapping is consumed. - vis_keys_push(..) with pos=0, appends new input to the end of the queue and starts processing it from the start of the queue, taking the full content into consideration. This is used by the main loop when new input becomes available. This patch switches the handling of <C-c> after a SIGINT from the former to the latter mechanism and fixes mappings using <C-c> in a non-leading position. Diffstat:
| M | vis.c | | | 3 | ++- |
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/vis.c b/vis.c @@ -1396,7 +1396,8 @@ int vis_run(Vis *vis) { vis_die(vis, "Killed by SIGTERM\n"); if (vis->interrupted) { vis->interrupted = false; - vis_keys_feed(vis, "<C-c>"); + vis_keys_push(vis, "<C-c>", 0, true); + continue; } if (vis->resume) {