diff options
author | Alexander Hall <halex@cvs.openbsd.org> | 2009-06-02 06:47:48 +0000 |
---|---|---|
committer | Alexander Hall <halex@cvs.openbsd.org> | 2009-06-02 06:47:48 +0000 |
commit | 27ce8947e56addc22190ca0c46ebdc31b0f7c8ff (patch) | |
tree | a44f5ba528eab3376916c9309814a5a4d250a442 /bin/ksh | |
parent | 35e113db931a948d74d95fc3f7ba20e4125723f8 (diff) |
fix macro handling
Diffstat (limited to 'bin/ksh')
-rw-r--r-- | bin/ksh/emacs.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c index 5a6025a58e7..0bfda96f0ab 100644 --- a/bin/ksh/emacs.c +++ b/bin/ksh/emacs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emacs.c,v 1.41 2007/08/02 10:50:25 fgsch Exp $ */ +/* $OpenBSD: emacs.c,v 1.42 2009/06/02 06:47:47 halex Exp $ */ /* * Emacs-like command line editing and history @@ -319,7 +319,6 @@ x_emacs(char *buf, size_t len) xlp_valid = true; xmp = NULL; x_curprefix = 0; - macroptr = (char *) 0; x_histp = histptr + 1; x_last_command = XFUNC_error; @@ -361,6 +360,9 @@ x_emacs(char *buf, size_t len) f = x_curprefix == -1 ? XFUNC_insert : x_tab[x_curprefix][c&CHARMASK]; + if (macroptr && f == XFUNC_ins_string) + f = XFUNC_insert; + if (!(x_ftab[f].xf_flags & XF_PREFIX) && x_last_command != XFUNC_set_arg) { x_arg = 1; @@ -1762,8 +1764,10 @@ x_e_getc(void) } else { if (macroptr) { c = *macroptr++; - if (!*macroptr) - macroptr = (char *) 0; + if (!c) { + macroptr = NULL; + c = x_getc(); + } } else c = x_getc(); } |