vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit a4dc4f22e9bfa9d63a1bcbc81da9c6d34d0748b7 parent 3440082d6db0cd15e0b8d654c67aa7606843c265 Author: Marc André Tanner <mat@brain-dump.org> Date: Sun, 25 Oct 2015 14:50:24 +0100 vis: introduce vis_repeat API Diffstat:
| M | vis.c | | | 14 | +++++++++----- |
| M | vis.h | | | 2 | ++ |
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/vis.c b/vis.c @@ -727,11 +727,7 @@ static const char *suspend(Vis *vis, const char *keys, const Arg *arg) { } static const char *repeat(Vis *vis, const char *keys, const Arg *arg) { - int count = vis->action.count; - vis->action = vis->action_prev; - if (count) - vis->action.count = count; - action_do(vis, &vis->action); + vis_repeat(vis); return keys; } @@ -2835,3 +2831,11 @@ bool vis_macro_replay(Vis *vis, enum VisMacro id) { buffer_release(&buf); return true; } + +void vis_repeat(Vis *vis) { + int count = vis->action.count; + vis->action = vis->action_prev; + if (count) + vis->action.count = count; + action_do(vis, &vis->action); +} diff --git a/vis.h b/vis.h @@ -147,6 +147,8 @@ bool vis_macro_record(Vis*, enum VisMacro); bool vis_macro_record_stop(Vis*); bool vis_macro_replay(Vis*, enum VisMacro); +void vis_repeat(Vis*); + bool vis_cmd(Vis*, const char *cmdline); const char *vis_keys(Vis*, const char *input);