From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3551 invoked by alias); 2 Feb 2014 22:17:41 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32342 Received: (qmail 3657 invoked from network); 2 Feb 2014 22:17:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1391379045; bh=912shhAOVSwcAVE9kxp7zf8Dax1lfCf7SFKPp3Pd9xc=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=GoJkIPux4vmD/LaEw3FiQFZBeJo2rujqQ+K3XU34zlkOqbLxB0ecTGAvh4dlq8WVqostHcATZiBUvaZV3uBtBe3lo/H0FmWcuonJIYqC7xmyk0g3UG24e/dtcLD2xVVYLQ9lfHs9GmOpgNt2JyTiN9iAXzNQTXPj9BS7SxKL8nI= X-Yahoo-Newman-Id: 82109.83992.bm@smtp112.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: qTc2Yq8VM1mvXQEOlOOMzVlvN9ZKSkIROE7H0KfycgJjKr8 sOJbmiyRGc9RCLpl6SEitLGcdP2kQXsKger8qASC.4K4WKLJGjBnbx.hh9EH 5QGIGzrOyfb.5dArGslXjeA.LEN16QIC1w2K4rS1yOVh_63pXQrJk5xI6jD7 QbIuGgltVjKnRZ7nRnrYI_eDKujAiPtYtNX_wU9uk7RACw6Usj7_vFH1aHBw u_ZLQIEjM1Fo95wg_ct9YwCGiyUqCefHe9Knvlj3LKIWqbJbZsB2n1UjKc4a g6iz0AgGt1Is6ZmBnk8HyiV6_jLA_qYaImCxOHthnOZnA2ajT5V7_fZFm0Dc tlx5pX2lgLkEnS0yD9e.dV7GiA9hFmDriLVVQ4dVXXQtFxi8G29atCdU3Bq6 O.c3zB0aWX74RVEXwJXXoCODbqQ9yrH9oU9V4x3aj7jAVK_szzezNv8vrOdR IIWRV2SV2Ooru0Pbmi1ioAn.Qp9aYZ6EcpmO0dAmLKRbyvPtTpCWbikwUXhu _y4AmMk5H4BKIxSJeyP8uLVJIFwk- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- X-Rocket-Received: from kiddle.eu (okiddle@95.222.210.25 with plain [188.125.69.59]) by smtp112.mail.ir2.yahoo.com with SMTP; 02 Feb 2014 22:10:45 +0000 UTC In-reply-to: <2700.1390950035@thecus.kiddle.eu> From: Oliver Kiddle References: <20130923213014.15f97f9e@pws-pc.ntlworld.com> <3511.1390605547@thecus.kiddle.eu> <140125111530.ZM21792@torch.brasslantern.com> <20140127124301.4144f2d9@pwslap01u.europe.root.pri> <20140127161124.2aa16b37@pwslap01u.europe.root.pri> <2700.1390950035@thecus.kiddle.eu> To: zsh-workers@zsh.org Subject: Re: zle: vi mode: wrong undo handling on fresh lines Date: Sun, 02 Feb 2014 23:10:43 +0100 Message-ID: <11588.1391379043@thecus.kiddle.eu> On 29 Jan, I wrote: > If someone has the overstrike option set, it should probably be 'R'. > Actually that option seems to be fully non-working for vi mode. It seems overstrike in vi mode is something we only just broke. This fixes it. Also, having collectively put some thought into what the synthesised vi command should be when repeating the first change, I thought it'd be a waste not to do something – even though it is a feature that nobody has ever missed. This uses 'o' for blank lines, mainly because it is the most useful, 'R' if overstrike is set, 'a' if the cursor is at the end of a non-blank line and 'i' otherwise. Oliver diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index ed8577b..b0010fc 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -1198,14 +1198,6 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish) statusline = NULL; selectkeymap("main", 1); initundo(); - /* - * If main is linked to the viins keymap, we need to register - * explicitly that we're now in vi insert mode as there's - * no user operation to indicate this. - */ - if (openkeymap("main") == openkeymap("viins")) - viinsert_init(); - selectlocalmap(NULL); fixsuffix(); if ((s = getlinknode(bufstack))) { setline(s, ZSL_TOEND); @@ -1222,6 +1214,14 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish) stackhist = -1; } } + /* + * If main is linked to the viins keymap, we need to register + * explicitly that we're now in vi insert mode as there's + * no user operation to indicate this. + */ + if (openkeymap("main") == openkeymap("viins")) + viinsert_init(); + selectlocalmap(NULL); if (isset(PROMPTCR)) putc('\r', shout); if (tmout) diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c index 79b8cb9..994b44f 100644 --- a/Src/Zle/zle_vi.c +++ b/Src/Zle/zle_vi.c @@ -79,8 +79,9 @@ static void startvichange(int im) { if (im != -1) { - insmode = im; vichgflag = 1; + if (im > -1) + insmode = im; } if (inrepeat && im != -2) { zmod = lastmod; @@ -92,7 +93,8 @@ startvichange(int im) free(vichgbuf); vichgbuf = (char *)zalloc(vichgbufsz = 16); if (im == -2) { - vichgbuf[0] = 'a'; + vichgbuf[0] = + zlell ? (insmode ? (zlecs < zlell ? 'i' : 'a') : 'R') : 'o'; } else { vichgbuf[0] = lastchar; }