Thanks for the patch, see the inline comments below for some remarks.
> ---
> vis.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/vis.c b/vis.c
> index 11cf1af..d18948a 100644
> --- a/vis.c
> +++ b/vis.c
> _AT_@ -556,6 +556,13 @@ static void op_delete(OperatorContext *c) {
> }
>
> static void op_change(OperatorContext *c) {
> + if(action.movement->txt == text_word_start_next) {
> + action.movement->txt = text_word_end_next;
> + action.movement->type |= INCLUSIVE;
your permanently changing movements here, once this is executed 'w'
will behave as 'e'. What you probably wanted is something along the
lines of:
if(action.movement == &moves[MOVE_WORD_START_NEXT])
action.movement = &moves[MOVE_WORD_END_NEXT];
To prevent errors like these, the various pointers in the Action struct
should be marked const.
However this still won't work because when
> op_delete(c);
is called, the movement has already been performed and op_delete works
based on c->range (that is the range spanned by the original movement).
The proper way to fix this is to check in movement(...) whether the
action.operator is set to &ops[OP_CHANGE] and if so adjust
action.movement accordingly.
Would be nice if you sent a follow up patch.
--
Marc André Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0
Received on Fri Apr 03 2015 - 21:06:29 CEST