mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-04 10:41:11 +02:00
users/17314: ensure an undo change number
uniquely specifies a point in editing history by incrementing the value returned by the variable.
This commit is contained in:
parent
8d9cb7f42e
commit
0fda80344b
2 changed files with 22 additions and 11 deletions
|
@ -1,5 +1,9 @@
|
||||||
2012-10-09 Peter Stephenson <pws@csr.com>
|
2012-10-09 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
|
* users/17314: Src/Zle/zle_utils.c: ensure an undo change number
|
||||||
|
uniquely specifies a point in editing history by incrementing
|
||||||
|
the value returned by the variable.
|
||||||
|
|
||||||
* unposted: Src/builtin.c: fix trivial typo with "functions +T".
|
* unposted: Src/builtin.c: fix trivial typo with "functions +T".
|
||||||
|
|
||||||
2012-10-07 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
2012-10-07 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
@ -248,5 +252,5 @@
|
||||||
|
|
||||||
*****************************************************
|
*****************************************************
|
||||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||||
* $Revision: 1.5741 $
|
* $Revision: 1.5742 $
|
||||||
*****************************************************
|
*****************************************************
|
||||||
|
|
|
@ -1520,23 +1520,25 @@ setlastline(void)
|
||||||
int
|
int
|
||||||
undo(char **args)
|
undo(char **args)
|
||||||
{
|
{
|
||||||
zlong last_change = (zlong)0;
|
zlong last_change;
|
||||||
|
|
||||||
if (*args)
|
if (*args)
|
||||||
{
|
|
||||||
last_change = zstrtol(*args, NULL, 0);
|
last_change = zstrtol(*args, NULL, 0);
|
||||||
}
|
else
|
||||||
|
last_change = (zlong)-1;
|
||||||
|
|
||||||
handleundo();
|
handleundo();
|
||||||
do {
|
do {
|
||||||
if(!curchange->prev)
|
struct change *prev = curchange->prev;
|
||||||
|
if(!prev)
|
||||||
return 1;
|
return 1;
|
||||||
if (unapplychange(curchange->prev))
|
if (prev->changeno < last_change)
|
||||||
curchange = curchange->prev;
|
break;
|
||||||
|
if (unapplychange(prev))
|
||||||
|
curchange = prev;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
} while (*args ? curchange->changeno != last_change :
|
} while (last_change >= (zlong)0 || (curchange->flags & CH_PREV));
|
||||||
(curchange->flags & CH_PREV));
|
|
||||||
setlastline();
|
setlastline();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1660,6 +1662,11 @@ zlecallhook(char *name, char *arg)
|
||||||
zlong
|
zlong
|
||||||
get_undo_current_change(UNUSED(Param pm))
|
get_undo_current_change(UNUSED(Param pm))
|
||||||
{
|
{
|
||||||
return undo_changeno;
|
/*
|
||||||
|
* Increment the number in case a change is in progress;
|
||||||
|
* we don't want to back off what's already been done when
|
||||||
|
* we return to this change number. This eliminates any
|
||||||
|
* problem about the point where a change is numbered.
|
||||||
|
*/
|
||||||
|
return ++undo_changeno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue