vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 2e725efe15466e3c21fea6580e4ca63385096ea6
parent e72b29faa5c383a70bd6c26c6dc483657723066f
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat,  6 May 2017 22:58:09 +0200

vis: add vis_interrupt{,requested} functions

Diffstat:
Mvis.c | 8++++++++
Mvis.h | 12++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/vis.c b/vis.c @@ -800,6 +800,14 @@ static void window_jumplist_invalidate(Win *win) { ringbuf_invalidate(win->jumplist); } +void vis_interrupt(Vis *vis) { + vis->interrupted = true; +} + +bool vis_interrupt_requested(Vis *vis) { + return vis->interrupted; +} + void vis_do(Vis *vis) { Win *win = vis->win; File *file = win->file; diff --git a/vis.h b/vis.h @@ -153,6 +153,18 @@ void vis_resume(Vis*); */ bool vis_signal_handler(Vis*, int signum, const siginfo_t *siginfo, const void *context); /** + * Interrupt long running operation. + * @rst + * .. warning:: There is no guarantee that a long running operation is actually + * interrupted. It is analogous to cooperative multitasking where + * the operation has to voluntarily yield control. + * .. note:: It is invoked from `vis_signal_handler` when receiving ``SIGINT``. + * @endrst + */ +void vis_interrupt(Vis*); +/** Check whether interruption was requested. */ +bool vis_interrupt_requested(Vis*); +/** * @} * @defgroup vis_draw * @{