Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in ZSH's vi emulation
- X-seq: zsh-workers 39820
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Bug in ZSH's vi emulation
- Date: Thu, 3 Nov 2016 07:55:55 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=wyRqjIEvSQDYOEDxfcYp2j964zHEtYU9SbGsVUagQeA=; b=RRJwDptq2O988yMNNe8I+FECCICRGt65ZecmT1/AcZc+pub0IPXAR9Yd4Kw5ITMBgd EwmVvrudTqxeDxdfPWRapj3wVi+BQGp5zD4MNfkTzlcAo7ZG9R1LwwdA1DeHGMRpXAov T78vI5TxVw4jIuiE+AZftKlewAxQGFoO4drPo73YJIJRBk8B904AaeLdzpBzMiQaL5VV jQBcoeoOM+IBb58TjuZm4XbQD40wKdOT8a0bNHLudH+6wRdLSa7b9peK3+xjFGFwmnHn wCuq9HGO8F7N+piTJ0JRZ/ZVocFgBefpyPTCvwy0unsQCqYpV/XhmSl6BZgN+E27ZwXj 5Pag==
- In-reply-to: <37864.1478176981@hydra.kiddle.eu>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20161005080921.GB26647@raspi> <161005101938.ZM12590@torch.brasslantern.com> <20161102045925.GA6763@fujitsu.shahaf.local2> <11719.1478105483@hydra.kiddle.eu> <161102214418.ZM12525@torch.brasslantern.com> <37864.1478176981@hydra.kiddle.eu>
On Nov 3, 1:43pm, Oliver Kiddle wrote:
}
} It might also be good to
} tweak the comment leading up to this function (startvichange) to
} reference keybuf instead of lastchar.
When making this change I also noticed that vichgbuf was not being
nul-terminated in the (im == -2) case.
Updated patch (replaces 39814):
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 1e0402d..95646a9 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -71,7 +71,7 @@ static int inrepeat, vichgrepeat;
* im: >= 0: is an insertmode
* -1: skip setting insert mode
* -2: entering viins at start of editing from clean --- don't use
- * inrepeat or lastchar, synthesise an i to enter insert mode.
+ * inrepeat or keybuf, synthesise an entery to insert mode.
*/
/**/
@@ -91,14 +91,16 @@ startvichange(int im)
lastmod = zmod;
if (vichgbuf)
free(vichgbuf);
- vichgbuf = (char *)zalloc(vichgbufsz = 16);
+ vichgbuf = (char *)zalloc(vichgbufsz = 16 + keybuflen);
if (im == -2) {
vichgbuf[0] =
zlell ? (insmode ? (zlecs < zlell ? 'i' : 'a') : 'R') : 'o';
+ vichgbuf[1] = '\0';
+ vichgbufptr = 1;
} else {
- vichgbuf[0] = lastchar;
+ strcpy(vichgbuf, keybuf);
+ unmetafy(vichgbuf, &vichgbufptr);
}
- vichgbufptr = 1;
vichgrepeat = 0;
}
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author