From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6853 invoked by alias); 11 Aug 2015 11:22:12 -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: 36096 Received: (qmail 11267 invoked from network); 11 Aug 2015 11:22:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1439291762; bh=T8tdviTu8EJe2l2rhO9REaR0T3j7fWhxYB8YPbFNs14=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=Dzty1EzNRxT2pxnc8VMFcmbjmd3mtOyyFpRh2t3hwN3TPFpCDj+Okyzemdo3yMAPPjAh+6DRn6f40gm1J5WYzOXa6Al7Ph5W+THjG51QAoSbrfaUcPaLP57AkCH9PInvfnrGV8tsjiCISZZTQSlNrFJGS0dNcEgnATmOulMI4BVWi+L8v2YgE98WoxGFZuoHMUAWjcn0r9DhHEygFu04/dF7dTkgD1XNOwHlh76cUhe55od2oUhxnJvlTEaS6Dw0aVpDcDa+tQKFK9J6teDJ5o11ZHvGNvGpB8YsoezLX8Mab+9guwa6qHe+skyI11K2RE4h6HYmilWZfeqnPxeU9w== X-Yahoo-Newman-Id: 288114.72899.bm@smtp125.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: _bu53YcVM1nfL0.Jhu9LjQLcEvF3KibdQaV1wJTEcQ.AKoD CsBAWMFGD2uRc6QJzNwe7JFE2ssUOl9TPqLhY0m2grnn5Qy1NhILEssv.Ckf t7B646lkfSTeL55I6j7Ha6NlFyo1pfz9XVZjm0aBtv3NLYi3Qn8PGPyAaKqg QS65BHeCy6SmZYE_l58CalZNz28zBJRYeUz_QjRsYMVaJGM5n82pTL78E93c ZVbHZz.L1em7TVVpqoEO8QKgCWdQiKIdwFRQkbJE8gQ8k8AqZWVn1PveVSik 12xRFmGRRlAItG9a9cdUh.WD5Rr4rJmfJw0ZugQZrxjbAYG_iC.I0lSLshDq MuVSmdnA36i1fD00koa_oen.eipopFr_EWdYVp47Pjr36gtNWlC5W3VJkyO3 L1mm0z0gLspB0XzzNUD0hyVCvaxVePWO1d5uD466VsLsc9RZib.Un5usjTG4 tdb.znY6_FcJcdNZ8_1zeTaQunt7KAP2fmnNH6NOux_PJL5KyUdnkL002mY8 alsGvFVkNbHPPNbNZ_Mfyuy.ZWWfTNw-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <9889.1437764790@thecus.kiddle.eu> From: Oliver Kiddle References: <7277.1437023995@thecus.kiddle.eu> <150716131504.ZM18155@torch.brasslantern.com> <150718110859.ZM4405@torch.brasslantern.com> <19088.1437274234@thecus.kiddle.eu> <485.1437632598@thecus.kiddle.eu> <150723220642.ZM18235@torch.brasslantern.com> <9889.1437764790@thecus.kiddle.eu> To: zsh workers Subject: Re: Vim special marks - Re: PATCH: highlight pasted text MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27929.1439291761.1@thecus.kiddle.eu> Date: Tue, 11 Aug 2015 13:16:01 +0200 Message-ID: <27930.1439291761@thecus.kiddle.eu> On 24 Jul, I wrote: > There's one very unfortunate > effect of this design choice, however: if the start of some inserted > text looks the same as what was there before, the undo mechanism will > identify the later characters as having been inserted rather than the > earlier ones. I've not come up with a solution to this. One part of the patch was actually a bug fix: the use of histline rather than curhist when checking whether the zle_goto_hist call is needed. This prevented you from returning to the original line. The following is a cut down version of the patch. It includes the addition of the . mark which uses the cursor position from the last change rather than the offset so is unaffected by the problem, Oliver diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c index d751c43..208839e 100644 --- a/Src/Zle/zle_move.c +++ b/Src/Zle/zle_move.c @@ -876,24 +876,36 @@ int vigotomark(UNUSED(char **args)) { ZLE_INT_T ch; + int *markcs, *markhist = 0; int oldcs = zlecs; int oldline = histline; + int tmpcs, tmphist; ch = getfullchar(0); - if (ch == ZWC('\'') || ch == ZWC('`')) - ch = 26; - else { - if (ch < ZWC('a') || ch > ZWC('z')) - return 1; - ch -= ZWC('a'); - } - if (!vimarkline[ch]) - return 1; - if (curhist != vimarkline[ch] && !zle_goto_hist(vimarkline[ch], 0, 0)) { - vimarkline[ch] = 0; + if (ch == ZWC('\'') || ch == ZWC('`')) { + markhist = vimarkline + 26; + markcs = vimarkcs + 26; + } else if (ch == ZWC('.') && curchange->prev) { + /* position cursor where it was after the last change. not exactly + * what vim does but close enough */ + tmpcs = curchange->prev->new_cs; + tmphist = curchange->prev->hist; + markcs = &tmpcs; + markhist = &tmphist; + } else if (ch >= ZWC('a') && ch <= ZWC('z')) { + markhist = vimarkline + (ch - ZWC('a')); + markcs = vimarkcs + (ch - ZWC('a')); + } else return 1; + if (markhist) { + if (!*markhist) + return 1; + if (histline != *markhist && !zle_goto_hist(*markhist, 0, 0)) { + *markhist = 0; + return 1; + } } - zlecs = vimarkcs[ch]; + zlecs = *markcs; vimarkcs[26] = oldcs; vimarkline[26] = oldline; if (zlecs > zlell)