bug-bash
[Top][All Lists]
Advanced

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

vi-mode [count]r should not fail at EOL (Modified by Len Lattanzi)


From: llattanzi+bash
Subject: vi-mode [count]r should not fail at EOL (Modified by Len Lattanzi)
Date: Tue, 22 Jun 2004 17:43:06 -0700 (PDT)

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: darwin8.0
Compiler: gcc
Compilation CFLAGS: -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp -arch i386 -arch ppc -pipe -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc' -DCONF_OSTYPE='darwin8.0' -DCONF_MACHTYPE='powerpc-apple-darwin8.0' -DCONF_VENDOR='apple' -DSHELL -DHAVE_CONFIG_H -DMACOSX -I. -I/SourceCache/bash/bash-30/bash -I/SourceCache/bash/bash-30/bash/include -I/SourceCache/bash/bash-30/bash/lib -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp -arch i386 -arch ppc -pipe uname output: Darwin stderr.apple.com 8.0.0b1 Darwin Kernel Version 8.0.0b1: Mon May 10 23:45:14 PDT 2004; root:xnu/xnu-600.3.obj~4/RELEASE_PPC Power Macintosh powerpc
Machine Type: powerpc-apple-darwin8.0

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
        vi-mode replacing characters upto EOL will trigger rl_ding

Repeat-By:
        set -o vi
        echo 12345<esc>4h5r0

Fix:
This fix also groups [count]r as a single group for undo

Index: bash/lib/readline/vi_mode.c
===================================================================
RCS file: /cvs/root/bash/bash/lib/readline/vi_mode.c,v
retrieving revision 1.1.1.5
diff -u -d -b -w -r1.1.1.5 vi_mode.c
--- vi_mode.c   2003/04/05 08:00:34     1.1.1.5
+++ vi_mode.c   2004/06/22 23:07:35
@@ -1285,11 +1285,12 @@
   if (c == '\033' || c == CTRL ('C'))
     return -1;

+  rl_begin_undo_group ();
   while (count-- && rl_point < rl_end)
     {
-      rl_begin_undo_group ();
+      int point = rl_point;

-      rl_delete (1, c);
+      rl_vi_delete (1, c);
 #if defined (HANDLE_MULTIBYTE)
       if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
        while (_rl_insert_char (1, c))
@@ -1300,12 +1301,14 @@
          }
       else
 #endif
+      {
+        if (rl_point < point) /* Did we retreat? */
+         rl_point++;
        _rl_insert_char (1, c);
-      if (count == 0)
-       rl_backward_char (1, c);
+      }

-      rl_end_undo_group ();
     }
+  rl_end_undo_group ();
   return (0);
 }





reply via email to

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