From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15401 invoked by alias); 5 Feb 2014 22:07:48 -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: 32355 Received: (qmail 15475 invoked from network); 5 Feb 2014 22:07:40 -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=1391637634; bh=+/JWqtyX6xDjnLu9oGfWYwfISBy9S6B8dBg4ocREPhQ=; 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=uiRRpy5Un/A7CXdDUlX6llFk2IH5UgrfUdZl3rudluujNDj3PsURnxwWXm0OyuHYwwaiQ6K6XSpdCbZcqiTOOWwU4BaWn+XVunX8zs+fVR62WJex6hSAcFwafzS8JDe2r64jtgCC41AmB6fGYkYbOPA0CXRFaMUvgj23ceetDPE= X-Yahoo-Newman-Id: 753624.78372.bm@smtp120.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: sbb.nIwVM1nHblwQcq.T1z71Z0UQRXU8vGuO7YQuqPgyhR9 t_yYprN457R8qyZRd6T64PQXH8b5DAORg9iXlpOBZ.mQtkX_pMoCqARhQK_I X33MoXLyGPT0XyAjFD02i5S4WkCGtX6AwVZSPfArtPkXseUSEsNkpJAZpmdY b2SCkOS3Do0KhP2nMQmARMQJ5RoDtpaHLcLxmOhZ0on4gYwEkQn3LofTnWnx Jfxn9LlGHIpUBvZk5l5CnisMQCCp.mFbkX1SXvqodcPJTuTj7oFPWxAazYN_ JaQ_efuly9.XT2Sxfz2COFogPhGVu45pXVgY6_pVBeYd.hP_jV6Y5GjseFTQ 0DZB1SkhcDzTPBWvF6_y05Pww6YqskGKw9GfS5bizcCLdX5VmBSdTPFcJEUm GxzkKcMhG0CStf.Aw9UG_suA.dVRQO2i1fuSD6X3xNat6fJE8rK8zzC2ybwE dJmR_V1ZjjmeeRfkNvpQLWHo470czkv5ANDvK7oyLQk_7RDpmp4PRb0khBfM j918kar79ImbcCohzmTZXXyV_BZo- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- X-Rocket-Received: from kiddle.eu (okiddle@95.222.210.25 with plain [188.125.69.59]) by smtp120.mail.ir2.yahoo.com with SMTP; 05 Feb 2014 22:00:34 +0000 UTC In-reply-to: <0DF7F868-2406-473B-9477-D9FA5F6109F5@kba.biglobe.ne.jp> 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> <19068.1391204240@thecus.kiddle.eu> <19751.1391207572@thecus.kiddle.eu> <163F74F2-3FA8-4478-B354-491C006590C9@kba.biglobe.ne.jp> <16516.1391462981@thecus.kiddle.eu> <17235.1391469962@thecus.kiddle.eu> <0DF7F868-2406-473B-9477-D9FA5F6109F5@kba.biglobe.ne.jp> To: zsh-workers@zsh.org Subject: Re: zle: vi mode: wrong undo handling on fresh lines Date: Wed, 05 Feb 2014 23:00:33 +0100 Message-ID: <2811.1391637633@thecus.kiddle.eu> "Jun T." wrote: > Thanks. It seems this solves my second problem. > > There is another problem, however: Thanks. Hopefully that's the end of it. Below is a patch for documentation and test cases. I'll push the changes now. Oliver diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index 2d77568..6d3bb4b 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -1293,8 +1293,11 @@ item(tt(redisplay))( Redisplay the command line, remaining in incremental search mode. ) item(tt(vi-cmd-mode))( -Toggle between the `tt(main)' and `tt(vicmd)' keymaps; +Select the `tt(vicmd)' keymap; the `tt(main)' keymap (insert mode) will be selected initially. + +In addition, the modifications that were made while in vi insert mode are +merged to form a single undo event. ) xitem(tt(vi-repeat-search)) item(tt(vi-rev-repeat-search))( @@ -2191,6 +2194,13 @@ tindex(spell-word) item(tt(spell-word) (ESC-$ ESC-S ESC-s) (unbound) (unbound))( Attempt spelling correction on the current word. ) +tindex(split-undo) +item(tt(split-undo))( +Breaks the undo sequence at the current change. This is useful in vi mode as +changes made in insert mode are coalesced on entering command mode. Similarly, +tt(undo) will normally revert as one all the changes made by a user-defined +widget. +) tindex(undefined-key) item(tt(undefined-key))( This command is executed when a key sequence that is not bound to any @@ -2202,6 +2212,10 @@ Incrementally undo the last text modification. When called from a user-defined widget, takes an optional argument indicating a previous state of the undo history as returned by the tt(UNDO_CHANGE_NO) variable; modifications are undone until that state is reached. + +Note that when invoked from vi command mode, the full prior change made in +insert mode is reverted, the changes having been merged when command mode was +selected. ) tindex(redo) item(tt(redo))( diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst index d4a125f..fe55d8a 100644 --- a/Test/X02zlevi.ztst +++ b/Test/X02zlevi.ztst @@ -10,6 +10,63 @@ %test + zletest $'word\euaend' +0:undo initial change +>BUFFER: end +>CURSOR: 3 + + zletest $'text\e.' +0:repeat initial edit +>BUFFER: text +>text +>CURSOR: 8 + + comptesteval 'print -z before' + zletest $'after\e.' +0:repeat initial edit with non-blank starting line +>BUFFER: beforeafterafter +>CURSOR: 15 + + comptesteval 'setopt overstrike;print -z bung' + zletest $'ing\e2|.' +0:repeat initial edit with overstrike set +>BUFFER: binging +>CURSOR: 3 + + comptesteval 'bindkey "^_" undo' + zletest $'undoc\037e' +0:use of undo in vi insert mode +>BUFFER: undoe +>CURSOR: 5 + + zletest $'one\euatwo\e0clthree' +0:vi mode undo of initial and subsequent change +>BUFFER: threewo +>CURSOR: 5 + + zletest $'xxx\euiyyy\euAz' +0:undo invoked twice +>BUFFER: z +>CURSOR: 1 + + comptesteval 'bindkey -a "^R" redo' + zletest $'123\C-_\e\C-r' +0:undo in insert mode, redo in command +>BUFFER: 123 +>CURSOR: 2 + + comptesteval 'bindkey "^Y" redo' + zletest $'pre\eA123\C-_\C-y\eu' +0:undo and redo in insert mode, undo in command +>BUFFER: pre +>CURSOR: 2 + + comptesteval 'bindkey "^Gu" split-undo' + zletest $'one\C-gutwo\eu' +0:split the undo sequence +>BUFFER: one +>CURSOR: 2 + zletest $'one two\ebmt3|`tx``' 0:setting mark and returning to original position >BUFFER: one wo diff --git a/Test/comptest b/Test/comptest index 10814d6..f1c5af0 100644 --- a/Test/comptest +++ b/Test/comptest @@ -72,8 +72,8 @@ zle-finish () { print -lr "" "BUFFER: $BUFFER" "CURSOR: $CURSOR" (( region_active )) && print -lr "MARK: $MARK" zle -K main - zle kill-whole-line zle clear-screen + zle send-break zle -R } zle -N expand-or-complete-with-report