diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-02-22 11:22:13 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-02-22 12:42:19 +0100 |
| commit | 75c24bb43ccbc0907eb427a44330e66986601f88 (patch) | |
| tree | 46bf504e528d9d83ae0f61c4a725f88d9ab5622b /main.c | |
| parent | 75ff22469b21e72a4c9126d89cfa3623af1784fd (diff) | |
| download | vis-75c24bb43ccbc0907eb427a44330e66986601f88.tar.gz vis-75c24bb43ccbc0907eb427a44330e66986601f88.tar.xz | |
vis: simplify `r` implementation and fix cursor positioning
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -1618,17 +1618,9 @@ static const char *replace(Vis *vis, const char *keys, const Arg *arg) { if (replacement[0] == 0x1b) /* <Escape> */ return next; - if (vis_mode_get(vis) == VIS_MODE_NORMAL) { - int count = vis_count_get_default(vis, 1); - vis_operator(vis, VIS_OP_CHANGE); + vis_operator(vis, VIS_OP_REPLACE, replacement); + if (vis_mode_get(vis) == VIS_MODE_OPERATOR_PENDING) vis_motion(vis, VIS_MOVE_CHAR_NEXT); - for (; count > 0; count--) - vis_keys_feed(vis, replacement[0] == '\n' ? "<Enter>" : replacement); - } else { - vis_operator(vis, VIS_OP_REPLACE, replacement); - } - - vis_keys_feed(vis, "<Escape>"); return next; } |
