On 2/16/11 11:43 PM, Clark J. Wang wrote:
> For example, in vi insert mode, I first enter a command like this:
> 
> # hello world
> 
> Then I press ESC and type cc, the cursor just moves to the beginning (under
> the char `h') and the whole line is not emptied. If I type more chars after
> cc, only the first `h' char is replaced and following `ello world' keeps
> unchanged. Note that other vi mode commands like cw and c$ work fine.

Thanks for the report.  Please try the attached patch; it fixes the problem
in the testing I've done.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.2/lib/readline/vi_mode.c  2010-11-20 19:51:39.000000000 -0500
--- lib/readline/vi_mode.c      2011-02-17 20:24:25.000000000 -0500
***************
*** 1115,1119 ****
        _rl_vi_last_motion = c;
        RL_UNSETSTATE (RL_STATE_VIMOTION);
!       return (0);
      }
  #if defined (READLINE_CALLBACKS)
--- 1115,1119 ----
        _rl_vi_last_motion = c;
        RL_UNSETSTATE (RL_STATE_VIMOTION);
!       return (vidomove_dispatch (m));
      }
  #if defined (READLINE_CALLBACKS)
*** ../bash-4.2/lib/readline/callback.c 2010-06-06 12:18:58.000000000 -0400
--- lib/readline/callback.c     2011-02-17 20:43:28.000000000 -0500
***************
*** 149,152 ****
--- 149,155 ----
          /* Should handle everything, including cleanup, numeric arguments,
             and turning off RL_STATE_VIMOTION */
+         if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
+           _rl_internal_char_cleanup ();
+ 
          return;
        }

Reply via email to