Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:undo! doesn't treat number as documented #22298

Open
echasnovski opened this issue Feb 17, 2023 · 2 comments
Open

:undo! doesn't treat number as documented #22298

echasnovski opened this issue Feb 17, 2023 · 2 comments
Assignees
Labels
bug issues reporting wrong behavior

Comments

@echasnovski
Copy link
Member

Describe the bug

Executing :undo! when not on latest change restores previous to target undo state.

Steps to reproduce

  1. nvim --clean -u NONE.
  2. Create undo history by typing:
    2.1. A, one, <Esc>.
    2.2. A, two, <Esc>.
    2.3. A, three, <Esc>.
    2.4. A, four, <Esc>.
    2.5. A, five, <Esc>.
  3. Press u. This will restore one two three four text in undo state 4.
  4. Execute :undo! 3. It should restore one two three text in undo state 3, but restores one two text in undo state 2. Executing :echo undotree() confirms that states 3, 4, 5 are deleted.

Expected behavior

:undo! always restores target undo state while deleting all states after it.

Notes:

  • When step 3 is skipped and :undo! 3 is executed on latest undo state, everything works as expected.

Neovim version (nvim -v)

NVIM v0.9.0-dev-987+g371a74e4e

Vim (not Nvim) behaves the same?

No (doesn't have this functionality)

Operating system/version

EndeavourOS Linux x86_64 (6.1.11-arch1-1)

Terminal name/version

st-0.9

$TERM environment variable

st-256color

Installation

appimage

@echasnovski echasnovski added the bug issues reporting wrong behavior label Feb 17, 2023
@zeertzjq zeertzjq added documentation and removed bug issues reporting wrong behavior labels Jul 26, 2023
@zeertzjq
Copy link
Member

The docs of :undo! seems wrong. The {N} has complete different meanings in :undo! {N} and :undo {N}.

@zeertzjq zeertzjq added bug issues reporting wrong behavior documentation and removed documentation labels Jul 26, 2023
@zeertzjq
Copy link
Member

Although the behavior does seem a bit strange...

@zeertzjq zeertzjq changed the title :undo! leads to restoration of previous to target state when executed not on latest undo state :undo! doesn't treat number as documented Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior
Projects
None yet
Development

No branches or pull requests

3 participants