summaryrefslogtreecommitdiffstats
path: root/bin/ksh/emacs.c
diff options
context:
space:
mode:
authorfgsch <fgsch@openbsd.org>2003-08-27 14:40:56 +0000
committerfgsch <fgsch@openbsd.org>2003-08-27 14:40:56 +0000
commitbd21a13f5c487af96712b47c5a7548634d1bbaf9 (patch)
treeb90be43a319a28932a2099063fc99565d422c467 /bin/ksh/emacs.c
parentthese are not needed here; henning@ ok. (diff)
downloadwireguard-openbsd-bd21a13f5c487af96712b47c5a7548634d1bbaf9.tar.xz
wireguard-openbsd-bd21a13f5c487af96712b47c5a7548634d1bbaf9.zip
escape on expand under emacs mode; otto@ ok.
Diffstat (limited to 'bin/ksh/emacs.c')
-rw-r--r--bin/ksh/emacs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c
index 6eee5626e86..bb096791847 100644
--- a/bin/ksh/emacs.c
+++ b/bin/ksh/emacs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: emacs.c,v 1.24 2003/08/26 17:55:01 fgsch Exp $ */
+/* $OpenBSD: emacs.c,v 1.25 2003/08/27 14:40:56 fgsch Exp $ */
/*
* Emacs-like command line editing and history
@@ -1783,12 +1783,15 @@ x_expand(c)
x_goto(xbuf + start);
x_delete(end - start, FALSE);
- for (i = 0; i < nwords; i++)
- if (x_ins(words[i]) < 0 || (i < nwords - 1 && x_ins(space) < 0))
+ for (i = 0; i < nwords;) {
+ if (x_escape(words[i], strlen(words[i]), x_emacs_putbuf) < 0 ||
+ (++i < nwords && x_ins(space) < 0))
{
x_e_putc(BEL);
return KSTD;
}
+ }
+ x_adjust();
return KSTD;
}