I wonder if my response to this patch got lost? It is working really
well for me... I was just wondering as i have not seen it appearing on
http://freshbsd.org/search?project=openbsd&q=
If it is just lack of time, that is the cause for that this patch has
not been committed, just do it whenever you have time, I have not
intention to stress people working on it :)
On 05/21/12 14:16, Martin Pieuchot wrote:
On 21/05/12(Mon) 10:59, Lars Engblom wrote:
On current snapshot (amd64), my ksh bindings are not working anymore.
For example if I have this in .kshrc:
bind -m '^L'="^Cclear^M"
set +o emacs-usemeta
This keybinding has been working for more than a year for me, prior to my
latest upgrade. The expected behavior would be Ctrl-C to interrupt the line
written followed by a 'clear' command and Enter. Now if i write 'ls'
and then
regret, wanting to clear the screen I get this visible on the screen:
$ ls^Cclear^M
This bug has been introduced in the last ksh change, thanks for reporting
it. The diff below should correct this behavior, can you confirm it works
for you?
Martin
Index: emacs.c
===================================================================
RCS file: /cvs/src/bin/ksh/emacs.c,v
retrieving revision 1.45
diff -u -p -r1.45 emacs.c
--- emacs.c 30 Apr 2012 03:51:29 -0000 1.45
+++ emacs.c 21 May 2012 11:08:37 -0000
@@ -108,6 +108,7 @@ static char *killstack[KILLSIZE];
static int killsp, killtp;
static int x_literal_set;
static int x_arg_set;
+static char *macro_args;
static int prompt_skip;
static int prompt_redraw;
@@ -343,11 +344,12 @@ x_emacs(char *buf, size_t len)
if (submatch == 1&& kmatch) {
if (kmatch->ftab->xf_func == x_ins_string&&
- kmatch->args) {
- /* insert macro string */
- x_ins(kmatch->args);
- }
- ret = kmatch->ftab->xf_func(c);
+ kmatch->args&& !macro_args) {
+ /* treat macro string as input */
+ macro_args = kmatch->args;
+ ret = KSTD;
+ } else
+ ret = kmatch->ftab->xf_func(c);
} else {
if (submatch)
continue;
@@ -410,7 +412,7 @@ x_insert(int c)
static int
x_ins_string(int c)
{
- return KSTD;
+ return x_insert(c);
}
static int x_do_ins(const char *cp, int len);
@@ -1862,6 +1864,12 @@ x_e_getc(void)
if (unget_char>= 0) {
c = unget_char;
unget_char = -1;
+ } else if (macro_args) {
+ c = *macro_args++;
+ if (!c) {
+ macro_args = NULL;
+ c = x_getc();
+ }
} else
c = x_getc();