[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] vi: add 'ZQ' quitting command
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2022-08-02 13:07:58
Message-ID: CAK1hOcMBOfZGLKy3uNp3fdbDRYb_CpLz2PBGpjuz8o_cpqmWLQ () mail ! gmail ! com
[Download RAW message or body]

Applied, thank you

On Wed, Jun 8, 2022 at 9:52 PM Grob Grobmann <grobgrobmann@gmail.com> wrote:
>
> Busybox vi provides the 'ZZ' command to save and close
> the similar 'ZQ' command just exits without saving
> I propose this small patch to add that command.
>
> diff --git a/editors/vi.c b/editors/vi.c
> index 3dbe5b471..2357caa5d 100644
> --- a/editors/vi.c
> +++ b/editors/vi.c
> @@ -4290,8 +4290,14 @@ static void do_cmd(int c)
>                         goto dc_i;      // start inserting
>                 break;
>         case 'Z':                       // Z- if modified, {write}; exit
> -               // ZZ means to save file (if necessary), then exit
>                 c1 = get_one_char();
> +               // ZQ means to exit without saving
> +               if (c1 == 'Q') {
> +                       editing=0;
> +                       optind = cmdline_filecnt;
> +                       break;
> +               }
> +               // ZZ means to save file (if necessary), then exit
>                 if (c1 != 'Z') {
>                         indicate_error();
>                         break;
>
> Cheers
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic