diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-11-07 22:48:39 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-11-09 01:03:47 +0100 |
commit | aa0e09d251610f9b17f0bf96a4f3485032c36e0f (patch) | |
tree | 24d02f4253faccf986731843ea662588d7f8935c /src/nvim/syntax.c | |
parent | 21dfbfbb9ab324b0731aec5c7b8556e106785e82 (diff) | |
download | rneovim-aa0e09d251610f9b17f0bf96a4f3485032c36e0f.tar.gz rneovim-aa0e09d251610f9b17f0bf96a4f3485032c36e0f.tar.bz2 rneovim-aa0e09d251610f9b17f0bf96a4f3485032c36e0f.zip |
'inccommand': Preserve curbuf->b_u_newhead.
Add tests for undotree().
Helped-by: Björn Linse <bjorn.linse@gmail.com>
When "curhead" points to a valid head, the value of "newhead" is
meaningless (and really should be set to null). The undo state for
a buffer is _logically_ the enum:
enum UndoState {
CurrentHead(head),
NewHead(head),
EmptyTree
}
nvim _represents_ this as: whenever `curbuf->b_u_curhead` is nonnull it
should be used as the current head, and `curbuf->b_u_newhead` is
ignored. If the there is a current head, then this will be redoed on the
next redo, and its parent will be undone on next undo. Only if
`b_u_curhead` is NULL, `b_u_newhead` will be used as the head to undo
(and it is not possible to redo). Also both can be NULL, to indicate an
empty undotree. (To be fair, this only strictly true when calling undo.c
from the outside, in some places _within_ a function in undo.c both
values might be meaningful)
Apparently `undotree()` breaks this non-abstraction, this _cosmetic_
issue can easily be fixed by `ex_substitute` also saving and restoring
`b_u_newhead`, but is doesn't reflect any error really how
`u_undo_and_forget` manipulates the _actual_ state of the undo tree.
Diffstat (limited to 'src/nvim/syntax.c')
0 files changed, 0 insertions, 0 deletions