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 via u does not remove file dirty flag #3201

Open
jaredmcateer opened this issue Nov 9, 2018 · 9 comments
Open

Undo via u does not remove file dirty flag #3201

jaredmcateer opened this issue Nov 9, 2018 · 9 comments

Comments

@jaredmcateer
Copy link

Describe the bug
Using u to undo changes doesn't restore the file to a clean state when reverting back to the original file that was opened.

To Reproduce
Steps to reproduce the behaviour:

  1. open file
  2. enter insert mode
  3. insert a space, observe tab has dirty icon
  4. exit to normal mode and press u to remove change
  5. File is still considered dirty

Expected behaviour
If you perform this same operation but instead of pressing u you press ctrl+z the file will return to a clean state, this should be the same for u

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 0.16.12
  • VSCode version: 1.28.2
  • OS: Ubuntu 18 LTS

Additional context
Related issue in vscode for context microsoft/vscode#919

@abbondanza
Copy link

This also applies to manual undos, not just those using u.

@abbondanza
Copy link

abbondanza commented Jan 31, 2019

Here's a quick solution to this problem (until there's an official one):

    "vim.normalModeKeyBindings": [
        {
            "before" : ["u"],
            "commands" : [
                "undo"
            ]
        },
        {
            "before" : ["<C-r>"],
            "commands" : [
                "redo"
            ]
        }
    ]

@Hultner
Copy link

Hultner commented Apr 5, 2019

Here's a quick solution to this problem (until there's an official one):

    "vim.normalModeKeyBindings": [
        {
            "before" : ["u"],
            "commands" : [
                "undo"
            ]
        },
        {
            "before" : ["<C-r>"],
            "commands" : [
                "redo"
            ]
        }
    ]

Neat trick, I came here for a different issue where undo seems to undo a ton of actions (much more then the editor undo) which makes undo/redo almost unusable for me at the moment.

@nzwane-r7
Copy link

Here's a quick solution to this problem (until there's an official one):

    "vim.normalModeKeyBindings": [
        {
            "before" : ["u"],
            "commands" : [
                "undo"
            ]
        },
        {
            "before" : ["<C-r>"],
            "commands" : [
                "redo"
            ]
        }
    ]

Neat trick, I came here for a different issue where undo seems to undo a ton of actions (much more then the editor undo) which makes undo/redo almost unusable for me at the moment.

@Hultner this might be the issue related to your experience: #2007

@AitBits
Copy link

AitBits commented May 30, 2019

This issue seems like a duplicate of #1490 to me.

@jaredmcateer
Copy link
Author

I disagree, all this ticket is asking is to set the file to pristine if the undo stack returns to the previous saved state. Now if the decision on that ticket is to rewrite the entire history stack to use vscode and this issue is resolved as a consequence then I'm fine with it being closed but otherwise I think they are currently two distinct issues

@J-Fields
Copy link
Member

While it's not the same issue, I don't think this can be fixed with the current VSCode API until #1490 is fixed.

@MrHate
Copy link

MrHate commented May 2, 2020

Here's a quick solution to this problem (until there's an official one):

    "vim.normalModeKeyBindings": [
        {
            "before" : ["u"],
            "commands" : [
                "undo"
            ]
        },
        {
            "before" : ["<C-r>"],
            "commands" : [
                "redo"
            ]
        }
    ]

A confusing point is, after I use O to produce an indented new line, I need to press u twice to undo this operation. One for the indent, the other one for the new line.

@Tsimopak
Copy link

Any news about this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants