On Sun, Nov 26 2017, Theo Buehler <t...@theobuehler.org> wrote:
> On Sun, Nov 26, 2017 at 08:18:04PM +0100, Anton Lindqvist wrote:
>> While at it, another gem: in Vi normal mode typing ^V inserts the
>> version string. Does not seem to be documented either.
>
> Yes, can we please zap it? It's utterly annoying, as I regularly trigger
> it when I want to edit the command line in $EDITOR.

Same diff here, ok jca@

> There are still the documented KSH_VERSION variable and the \v and \V
> escapes for PS1 that make use of the ksh_version string.

Yup.  Before someone proposes to remove or significantly change the
content of the version string: please think about shell scripts out
there that might use KSH_VERSION.

> Index: vi.c
> ===================================================================
> RCS file: /var/cvs/src/bin/ksh/vi.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 vi.c
> --- vi.c      2 Sep 2017 18:53:53 -0000       1.49
> +++ vi.c      26 Nov 2017 20:29:03 -0000
> @@ -140,7 +140,6 @@ const unsigned char       classify[128] = {
>  #define VREDO                7               /* . */
>  #define VLIT         8               /* ^V */
>  #define VSEARCH              9               /* /, ? */
> -#define VVERSION     10              /* <ESC> ^V */
>  
>  static char          undocbuf[LINE];
>  
> @@ -223,7 +222,7 @@ x_vi(char *buf, size_t len)
>                               trapsig(c == edchars.intr ? SIGINT : SIGQUIT);
>                               x_mode(false);
>                               unwind(LSHELL);
> -                     } else if (c == edchars.eof && state != VVERSION) {
> +                     } else if (c == edchars.eof) {
>                               if (es->linelen == 0) {
>                                       x_vi_zotc(edchars.eof);
>                                       c = -1;
> @@ -301,14 +300,6 @@ vi_hook(int ch)
>                                               return -1;
>                                       refresh(0);
>                               }
> -                             if (state == VVERSION) {
> -                                     save_cbuf();
> -                                     es->cursor = 0;
> -                                     es->linelen = 0;
> -                                     putbuf(ksh_version + 4,
> -                                         strlen(ksh_version + 4), 0);
> -                                     refresh(0);
> -                             }
>                       }
>               }
>               break;
> @@ -323,12 +314,6 @@ vi_hook(int ch)
>               state = VNORMAL;
>               break;
>  
> -     case VVERSION:
> -             restore_cbuf();
> -             state = VNORMAL;
> -             refresh(0);
> -             break;
> -
>       case VARG1:
>               if (isdigit(ch))
>                       argc1 = argc1 * 10 + ch - '0';
> @@ -554,8 +539,6 @@ nextstate(int ch)
>               return VXCH;
>       else if (ch == '.')
>               return VREDO;
> -     else if (ch == CTRL('v'))
> -             return VVERSION;
>       else if (is_cmd(ch))
>               return VCMD;
>       else
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to