From be0a71b9ce42622c4f06be6842760bd131ef1915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 14 Nov 2020 08:48:28 +0100 Subject: vis: fix 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 after a SIGINT from the former to the latter mechanism and fixes mappings using in a non-leading position. --- vis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index b162c45..d39c4b1 100644 --- 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, ""); + vis_keys_push(vis, "", 0, true); + continue; } if (vis->resume) { -- cgit v1.2.3