Re: [dev] [vis] [PATCH] Do not lump together replace actions

From: Marc André Tanner <mat_AT_brain-dump.org>
Date: Tue, 3 Feb 2015 13:57:22 +0100

On Tue, Jan 27, 2015 at 11:37:42AM -0500, Wolfgang Corcoran-Mathe wrote:
> Currently, the replace operator in vis gets lumped with following actions
> in the {un,re}do tree. Using the 'r' key several times then attempting
> to undo the last replacement undoes the entire series.
>
> ---
> vis.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/vis.c b/vis.c
> index 87d6cd1..6112ef1 100644
> --- a/vis.c
> +++ b/vis.c
> _AT_@ -871,8 +871,8 @@ static void replace(const Arg *arg) {
> if (!k.str[0])
> return;
> size_t pos = window_cursor_get(vis->win->win);
> - action_reset(&action_prev);
> - action_prev.op = &ops[OP_REPEAT_REPLACE];
> + action_reset(&action);
> + action.op = &ops[OP_REPEAT_REPLACE];
> buffer_put(&buffer_repeat, k.str, strlen(k.str));
> editor_delete_key(vis);
> editor_insert_key(vis, k.str, strlen(k.str));

Thanks for the patch! I will fix it by adding an explicit:

        text_snapshot(vis->win->text);

And yes the replace implementation could be improved.

Cheers,
Marc

-- 
 Marc André Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0
Received on Tue Feb 03 2015 - 13:57:22 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 03 2015 - 14:00:10 CET