about summary refs log tree commit diff
path: root/Doc/Zsh/zle.yo
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-07-09 19:29:59 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-07-09 19:29:59 +0100
commit2833299312dc3600849bd82ae7b93f5538cc10bb (patch)
tree61528c0923a1d5b64b0266ef517d0149c9898ba5 /Doc/Zsh/zle.yo
parent41888ae936cbf2a978cdf96f87804ef59861fc53 (diff)
downloadzsh-2833299312dc3600849bd82ae7b93f5538cc10bb.tar.gz
zsh-2833299312dc3600849bd82ae7b93f5538cc10bb.tar.xz
zsh-2833299312dc3600849bd82ae7b93f5538cc10bb.zip
35708: add UNDO_LIMIT_NO
Diffstat (limited to 'Doc/Zsh/zle.yo')
-rw-r--r--Doc/Zsh/zle.yo23
1 files changed, 22 insertions, 1 deletions
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index d3f067031..da8ee4721 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -960,6 +960,26 @@ A number representing the state of the undo history.  The only use
 of this is passing as an argument to the tt(undo) widget in order to
 undo back to the recorded point.  Read-only.
 )
+vindex(UNDO_LIMIT_NO)
+item(tt(UNDO_LIMIT_NO) (integer))(
+A number corresponding to an existing change in the undo history;
+compare tt(UNDO_CHANGE_NO).  If this is set to a value greater
+than zero, the tt(undo) command will not allow the line to
+be undone beyond the given change number.  It is still possible
+to use `tt(zle undo) var(change)' in a widget to undo beyond
+that point; in that case, it will not be possible to undo at
+all until tt(UNDO_LIMIT_NO) is reduced.  Set to 0 to disable the limit.
+
+A typical use of this variable in a widget function is as follows:
+
+example(integer save_limit=$UNDO_LIMIT_NO
+UNDO_LIMIT_NO=$UNDO_CHANGE_NO
+{
+  # Perform some form of recursive edit.
+} always {
+  UNDO_LIMIT_NO=save_limit
+})
+)
 vindex(WIDGET)
 item(tt(WIDGET) (scalar))(
 The name of the widget currently being executed; read-only.
@@ -2333,7 +2353,8 @@ item(tt(undo) (tt(^_ ^Xu ^X^U)) (tt(u)) (unbound))(
 Incrementally undo the last text modification.  When called from a
 user-defined widget, takes an optional argument indicating a previous state
 of the undo history as returned by the tt(UNDO_CHANGE_NO) variable;
-modifications are undone until that state is reached.
+modifications are undone until that state is reached, subject to
+any limit imposed by the tt(UNDO_LIMIT_NO) variable.
 
 Note that when invoked from vi command mode, the full prior change made in
 insert mode is reverted, the changes having been merged when command mode was