From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10835 invoked by alias); 27 Jan 2014 12:53:14 -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: 32307 Received: (qmail 8195 invoked from network); 27 Jan 2014 12:53:08 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,T_FRT_FOLLOW2 autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f796d000005a13-bc-52e654572340 Date: Mon, 27 Jan 2014 12:43:01 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: zle: vi mode: wrong undo handling on fresh lines Message-id: <20140127124301.4144f2d9@pwslap01u.europe.root.pri> In-reply-to: <140125111530.ZM21792@torch.brasslantern.com> References: <20130923213014.15f97f9e@pws-pc.ntlworld.com> <3511.1390605547@thecus.kiddle.eu> <140125111530.ZM21792@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjluLIzCtJLcpLzFFi42I5/e/4Nd3wkGdBBn2b2C0ONj9kcmD0WHXw A1MAYxSXTUpqTmZZapG+XQJXxt0pXawFV4QqmnumsjQwrufrYuTkkBAwkVj08CcbhC0mceHe eiCbi0NIYCmjREdPAzuEs5xJYlL3M7AqFgFViYnblzCC2GwChhJTN80Gs0UExCXOrj3PAmIL C9hKnP+9hhXE5hWwl7i4ZCc7iM0pYCWx7FsTK8TQ64wSczf+YQZJ8AvoS1z9+4kJ4gx7iZlX zjBCNAtK/Jh8D2wos4CWxOZtTawQtrzE5jVvmScwCsxCUjYLSdksJGULGJlXMYqmliYXFCel 5xrqFSfmFpfmpesl5+duYoSE4ZcdjIuPWR1iFOBgVOLhTZB+FiTEmlhWXJl7iFGCg1lJhDfH FCjEm5JYWZValB9fVJqTWnyIkYmDU6qBcVXS6xcvoxQPxDYZ/Tnw6/XryYKnL4Vle114qhDe ULS5XmrmstpnCstCjOUCQlr9Ep4q20ZdsDkf68QnyPtg5XqWD2c2Jumy7+Ncv/ZRwy4D9nff jDa0L3+Q8koue8mF2l/MC289Pjlr7WOda3MrbcUWlO+ufPyz+02q484H9o+6eZ4zSRVsdFZi Kc5INNRiLipOBAAelIfBIQIAAA== On Sat, 25 Jan 2014 11:15:30 -0800 Bart Schaefer wrote: > On Jan 25, 12:19am, Oliver Kiddle wrote: > } > } I find the effect of this change to undo to be very annoying. Typically > } undo now wipes the whole buffer which isn't much use. In particular, the > } old behaviour of undo after a completion is important to me. I > } understand that it rightly should be marking the start of an insertion > } at this point. > > Yes, I think it's a bug that completion doesn't behave as if you've > left and then re-entered insert mode. That's a bit different than what > you mentioned about the vim behavior. So presumably startvichange() needs calling somewhere else? It's not clear where, since it's only used inside zle_vi.c, which has nothing to do with completion. Maybe there needs to be a hook from the outside world. There is some interaction with completion in the top-level docomplete() call: /* For vi mode, reset the start-of-insertion pointer to the beginning * * of the word being completed, if it is currently later. Vi itself * * would never change the pointer in the middle of an insertion, but * * then vi doesn't have completion. More to the point, this is only * * an emulation. */ if (viinsbegin > ztrsub(zlemetaline + wb, zlemetaline)) viinsbegin = ztrsub(zlemetaline + wb, zlemetaline); but that doesn't look like it's relevant here. The only other mention down there that I can see is when expanding history, which is a different matter. > } However, even aside from that, the change doesn't seem to > } be quite right: e.g. vi-repeat (dot) can't repeat the initial insertion. > > Worse than that, vi-repeat forllowing the initial insertion repeats > the accept-line from the end of the previous command, thus attempting > to execute the (usually partial) current command line immediately. > > Clearly more is needed to properly set up the vi-mode state at the start > of the buffer. That kind of suggests there's some stuff startvitext() or startvichange() ought to be doing already but isn't, but we've got away with it somehow. inrepeat and vichgrepeat presumably have something to do with it. I'm not going to be much use smoothing out all the wrinkles, since I never use vi mode. pws