From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Another <ffffffff>
Date: Mon, 04 Apr 2016 13:58:26 +0100 [thread overview]
Message-ID: <20160404135826.1050fea7@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20160404124945.7be02c99@pwslap01u.europe.root.pri>
Sorry, try this one instead...
pws
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 382eb8d..7734ddc 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1615,8 +1615,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
else
lastchar = lastc;
if(lastlen != keybuflen) {
- unmetafy(keybuf + lastlen, &keybuflen);
- ungetbytes(keybuf+lastlen, keybuflen);
+ ungetbytes_unmeta(keybuf+lastlen, keybuflen);
if(vichgflag)
vichgbufptr -= keybuflen;
keybuf[lastlen] = 0;
@@ -1672,7 +1671,7 @@ getkeybuf(int w)
mod_export void
ungetkeycmd(void)
{
- ungetbytes(keybuf, keybuflen);
+ ungetbytes_unmeta(keybuf, keybuflen);
}
/* read a command from the current keymap, with widgets */
@@ -1690,17 +1689,12 @@ getkeycmd(void)
if(!*seq)
return NULL;
if(!func) {
- int len;
- char *pb;
-
if (++hops == 20) {
zerr("string inserting another one too many times");
hops = 0;
return NULL;
}
- pb = unmetafy(ztrdup(str), &len);
- ungetbytes(pb, len);
- zfree(pb, strlen(str) + 1);
+ ungetbytes_unmeta(str, strlen(str));
goto sentstring;
}
if (func == Th(z_executenamedcmd) && !statusline) {
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 104e5d6..472e326 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -357,6 +357,21 @@ ungetbytes(char *s, int len)
ungetbyte(*--s);
}
+/**/
+void
+ungetbytes_unmeta(char *s, int len)
+{
+ s += len;
+ while (len--) {
+ if (len && s[-2] == Meta) {
+ ungetbyte(*--s ^ 32);
+ len--;
+ s--;
+ } else
+ ungetbyte(*--s);
+ }
+}
+
#if defined(pyr) && defined(HAVE_SELECT)
static int
breakread(int fd, char *buf, int n)
next prev parent reply other threads:[~2016-04-04 12:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-04 11:35 Daniel Shahaf
2016-04-04 11:49 ` Peter Stephenson
2016-04-04 12:56 ` Peter Stephenson
2016-04-04 12:58 ` Peter Stephenson [this message]
2016-04-04 13:51 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160404135826.1050fea7@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).