bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash 3.0 vi-change-char fix


From: Tim Waugh
Subject: bash 3.0 vi-change-char fix
Date: Tue, 10 Aug 2004 09:38:05 +0100
User-agent: Mutt/1.4.1i

I received this bug report:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=129526

-->
Steps to Reproduce:
1. Launch a bash shell
2. Set editing mode to 'vi' with 'set -o vi'
3. Type any command, but don't hit return
4. Enter vi-command mode by hitting the escape key
5. Go to the end of line with the '$' command
6. Type 'r' to change the last character
7. Type any character (other than what the character already is)

The last two characters are inexplicably swapped
after the last character is changed.
<--

Here is the fix:

--- bash-3.0/lib/readline/vi_mode.c.changechar  2004-08-10 09:14:04.959899571 
+0100
+++ bash-3.0/lib/readline/vi_mode.c     2004-08-10 09:31:26.016912071 +0100
@@ -1310,12 +1310,16 @@
       rl_vi_delete (1, c);
 #if defined (HANDLE_MULTIBYTE)
       if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
-       while (_rl_insert_char (1, c))
-         {
-           RL_SETSTATE (RL_STATE_MOREINPUT);
-           c = rl_read_key ();
-           RL_UNSETSTATE (RL_STATE_MOREINPUT);
-         }
+       {
+         if (rl_point < p)             /* Did we retreat at EOL? */
+           rl_point++;
+         while (_rl_insert_char (1, c))
+           {
+             RL_SETSTATE (RL_STATE_MOREINPUT);
+             c = rl_read_key ();
+             RL_UNSETSTATE (RL_STATE_MOREINPUT);
+           }
+       }
       else
 #endif
        {

Tim.
*/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]