|
|
1a53a7 |
diff -up ksh-20120801/src/cmd/ksh93/edit/edit.c.trajfiks ksh-20120801/src/cmd/ksh93/edit/edit.c
|
|
|
1a53a7 |
--- ksh-20120801/src/cmd/ksh93/edit/edit.c.trajfiks 2012-08-02 00:18:19.000000000 +0200
|
|
|
1a53a7 |
+++ ksh-20120801/src/cmd/ksh93/edit/edit.c 2014-02-06 12:12:11.570942651 +0100
|
|
|
1a53a7 |
@@ -53,6 +53,7 @@
|
|
|
1a53a7 |
|
|
|
1a53a7 |
static char CURSOR_UP[20] = { ESC, '[', 'A', 0 };
|
|
|
1a53a7 |
static char KILL_LINE[20] = { ESC, '[', 'J', 0 };
|
|
|
1a53a7 |
+static char *savelex;
|
|
|
1a53a7 |
|
|
|
1a53a7 |
|
|
|
1a53a7 |
|
|
|
1a53a7 |
@@ -232,6 +233,8 @@ int tty_set(int fd, int action, struct t
|
|
|
1a53a7 |
void tty_cooked(register int fd)
|
|
|
1a53a7 |
{
|
|
|
1a53a7 |
register Edit_t *ep = (Edit_t*)(shgd->ed_context);
|
|
|
1a53a7 |
+ if(ep->sh->st.trap[SH_KEYTRAP] && savelex)
|
|
|
1a53a7 |
+ memcpy(ep->sh->lex_context,savelex,ep->sh->lexsize);
|
|
|
1a53a7 |
ep->e_keytrap = 0;
|
|
|
1a53a7 |
if(ep->e_raw==0)
|
|
|
1a53a7 |
return;
|
|
|
1a53a7 |
@@ -783,6 +786,13 @@ void ed_setup(register Edit_t *ep, int f
|
|
|
1a53a7 |
ep->e_lbuf[n] = *pp++;
|
|
|
1a53a7 |
ep->e_default = 0;
|
|
|
1a53a7 |
}
|
|
|
1a53a7 |
+ if(ep->sh->st.trap[SH_KEYTRAP])
|
|
|
1a53a7 |
+ {
|
|
|
1a53a7 |
+ if(!savelex)
|
|
|
1a53a7 |
+ savelex = (char*)malloc(shp->lexsize);
|
|
|
1a53a7 |
+ if(savelex)
|
|
|
1a53a7 |
+ memcpy(savelex, ep->sh->lex_context, ep->sh->lexsize);
|
|
|
1a53a7 |
+ }
|
|
|
1a53a7 |
}
|
|
|
1a53a7 |
|
|
|
1a53a7 |
static void ed_putstring(register Edit_t *ep, const char *str)
|
|
|
1a53a7 |
diff -up ksh-20120801/src/cmd/ksh93/include/defs.h.trajfiks ksh-20120801/src/cmd/ksh93/include/defs.h
|
|
|
1a53a7 |
--- ksh-20120801/src/cmd/ksh93/include/defs.h.trajfiks 2014-02-06 12:18:13.149091836 +0100
|
|
|
1a53a7 |
+++ ksh-20120801/src/cmd/ksh93/include/defs.h 2014-02-06 12:18:13.175091784 +0100
|
|
|
1a53a7 |
@@ -224,6 +224,7 @@ struct shared
|
|
|
1a53a7 |
int xargexit; \
|
|
|
1a53a7 |
int nenv; \
|
|
|
1a53a7 |
mode_t mask; \
|
|
|
1a53a7 |
+ int lexsize; \
|
|
|
1a53a7 |
Env_t *env; \
|
|
|
1a53a7 |
void *init_context; \
|
|
|
1a53a7 |
void *mac_context; \
|
|
|
1a53a7 |
diff -up ksh-20120801/src/cmd/ksh93/sh/lex.c.trajfiks ksh-20120801/src/cmd/ksh93/sh/lex.c
|
|
|
1a53a7 |
--- ksh-20120801/src/cmd/ksh93/sh/lex.c.trajfiks 2014-02-06 12:19:13.587950320 +0100
|
|
|
1a53a7 |
+++ ksh-20120801/src/cmd/ksh93/sh/lex.c 2014-02-06 12:19:13.623950219 +0100
|
|
|
1a53a7 |
@@ -268,6 +268,7 @@ Lex_t *sh_lexopen(Lex_t *lp, Shell_t *sp
|
|
|
1a53a7 |
{
|
|
|
1a53a7 |
lp = (Lex_t*)newof(0,Lex_t,1,0);
|
|
|
1a53a7 |
lp->sh = sp;
|
|
|
1a53a7 |
+ sp->lexsize = sizeof(Lex_t);
|
|
|
1a53a7 |
}
|
|
|
1a53a7 |
fcnotify(lex_advance,lp);
|
|
|
1a53a7 |
lp->lex.intest = lp->lex.incase = lp->lex.skipword = lp->lexd.warn = 0;
|