mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-26 02:30:58 +01:00
users/17908: Keep history line in sync between ZLE and shell.
Update ZLE version if history is read, pushed or popped with ZLE active
This commit is contained in:
parent
180c4c049c
commit
0b185e3dcd
4 changed files with 25 additions and 1 deletions
|
|
@ -1,3 +1,9 @@
|
||||||
|
2013-08-08 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
|
* users/17908: Src/hist.c Src/Zle/zle_main.c Src/zsh.h: if
|
||||||
|
modifying history with ZLE active, keep the history line
|
||||||
|
recorded in ZLE in sync.
|
||||||
|
|
||||||
2013-08-07 Phil Pennock <pdpennock@users.sourceforge.net>
|
2013-08-07 Phil Pennock <pdpennock@users.sourceforge.net>
|
||||||
|
|
||||||
* 31634: Functions/Misc/run-help: run-help compat with alias to
|
* 31634: Functions/Misc/run-help: run-help compat with alias to
|
||||||
|
|
|
||||||
|
|
@ -1934,6 +1934,13 @@ zle_main_entry(int cmd, va_list ap)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ZLE_CMD_SET_HIST_LINE:
|
||||||
|
{
|
||||||
|
histline = va_arg(ap, zlong);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
dputs("Bad command %d in zle_main_entry", cmd);
|
dputs("Bad command %d in zle_main_entry", cmd);
|
||||||
|
|
|
||||||
10
Src/hist.c
10
Src/hist.c
|
|
@ -76,6 +76,9 @@ mod_export int excs, exlast;
|
||||||
* and a temporary history entry is inserted while the user is editing.
|
* and a temporary history entry is inserted while the user is editing.
|
||||||
* If the resulting line was not added to the list, a flag is set so
|
* If the resulting line was not added to the list, a flag is set so
|
||||||
* that curhist will be decremented in hbegin().
|
* that curhist will be decremented in hbegin().
|
||||||
|
*
|
||||||
|
* Note curhist is passed to zle on variable length argument list:
|
||||||
|
* type must match that retrieved in zle_main_entry.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
@ -2414,6 +2417,9 @@ readhistfile(char *fn, int err, int readflags)
|
||||||
zerr("can't read history file %s", fn);
|
zerr("can't read history file %s", fn);
|
||||||
|
|
||||||
unlockhistfile(fn);
|
unlockhistfile(fn);
|
||||||
|
|
||||||
|
if (zleactive)
|
||||||
|
zleentry(ZLE_CMD_SET_HIST_LINE, curhist);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
|
|
@ -3339,6 +3345,8 @@ pushhiststack(char *hf, zlong hs, zlong shs, int level)
|
||||||
}
|
}
|
||||||
hist_ring = NULL;
|
hist_ring = NULL;
|
||||||
curhist = histlinect = 0;
|
curhist = histlinect = 0;
|
||||||
|
if (zleactive)
|
||||||
|
zleentry(ZLE_CMD_SET_HIST_LINE, curhist);
|
||||||
histsiz = hs;
|
histsiz = hs;
|
||||||
savehistsiz = shs;
|
savehistsiz = shs;
|
||||||
inithist(); /* sets histtab */
|
inithist(); /* sets histtab */
|
||||||
|
|
@ -3378,6 +3386,8 @@ pophiststack(void)
|
||||||
histtab = h->histtab;
|
histtab = h->histtab;
|
||||||
hist_ring = h->hist_ring;
|
hist_ring = h->hist_ring;
|
||||||
curhist = h->curhist;
|
curhist = h->curhist;
|
||||||
|
if (zleactive)
|
||||||
|
zleentry(ZLE_CMD_SET_HIST_LINE, curhist);
|
||||||
histlinect = h->histlinect;
|
histlinect = h->histlinect;
|
||||||
histsiz = h->histsiz;
|
histsiz = h->histsiz;
|
||||||
savehistsiz = h->savehistsiz;
|
savehistsiz = h->savehistsiz;
|
||||||
|
|
|
||||||
|
|
@ -2756,7 +2756,8 @@ enum {
|
||||||
ZLE_CMD_RESET_PROMPT,
|
ZLE_CMD_RESET_PROMPT,
|
||||||
ZLE_CMD_REFRESH,
|
ZLE_CMD_REFRESH,
|
||||||
ZLE_CMD_SET_KEYMAP,
|
ZLE_CMD_SET_KEYMAP,
|
||||||
ZLE_CMD_GET_KEY
|
ZLE_CMD_GET_KEY,
|
||||||
|
ZLE_CMD_SET_HIST_LINE
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************************/
|
/***************************************/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue