-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Using :write
after any command that produces changes introduces a phantom change
#2192
Comments
oh so here you got two bugs, 1 pipe producing a change even though one didn't neccisarly happen, 2 write not clearing the change if a change happened |
Correction: the issue happens with any command that produces changes. Try # ~/.config/helix/config.toml
# <...>
[keys.normal]
C-h = ["indent", ":write"]
# <...> @jappeace I would argue that |
:write
after :pipe
introduces a phantom change:write
after any command that produces changes introduces a phantom change
So... here's a chain of relevant calls on helix/helix-term/src/commands/typed.rs Lines 235 to 241 in d2b1add
In helix/helix-term/src/commands/typed.rs Lines 224 to 225 in d2b1add
helix/helix-view/src/document.rs Lines 441 to 447 in d2b1add
In helix/helix-view/src/document.rs Lines 469 to 470 in d2b1add
helix/helix-view/src/document.rs Lines 832 to 838 in d2b1add
So, helix/helix-view/src/document.rs Lines 824 to 830 in d2b1add
Taking the example from above, the difference between the mapped sequence of commands In helix/helix-term/src/ui/editor.rs Lines 1255 to 1259 in d2b1add
helix/helix-view/src/document.rs Lines 799 to 818 in d2b1add
A solution to this issue would be to append the changes of each command in a command sequence to history. Or maybe only before commands that should mark the document as unmodified. Speaking of which, there is a new handy-dandy command to append the changes manually: helix/helix-term/src/commands.rs Lines 3005 to 3008 in d2b1add
One can use it as a workaround to the original issue as follows: # ~/.config/helix/config.toml
# <...>
[keys.normal]
C-l = [":pipe echo '# test'", "commit_undo_checkpoint", ":write"]
C-h = ["indent", "commit_undo_checkpoint", ":write"]
# <...> |
Another place that a similar or the same bug shows up is if you bind |
Came across this issue while searching to see if the problem @sourcefrog mentions already has an issue filed. Unsure if this "save in insert mode has remaining [+]" problem is covered by this issue. Either way, hope it gets a fix soon-ish, as while it's a minor visual bug it is quite distracting for me personally. |
This was likely fixed by #2267. Feel free to reopen if not. |
Hmm... it does not appear fixed (at least on current HEAD: 789833c). I have this config.toml [keys.insert]
"esc" = ["normal_mode", ":write"] It does work, but it doesn't update the statusline correctly. (Try inserting in a file and then hit escape. The change was written to disk, but the statusline still says it's dirty.) Interestingly, when I press I'm not 100% sure if this is the bug mentioned here. I'll open another issue if needed. |
Summary
Something in the code introduces a change of state after executing a sequence of commands that contains
:pipe
and ends with:write
.Reproduction Steps
Consider the following config:
After restarting Helix, do the following:
:q!
I expected this to happen:
The key should print
# test
and write the buffer.Instead, this happened:
The key does the above, but it also introduces a phantom change. That is, the state of the buffer appears to be modified, according to the indicator in the status bar.
Helix log
Reproducing this issue doesn't emit relevant log messages.
Platform
Linux
Terminal Emulator
GNOME Terminal 3.42.2 using VTE 0.66.2 +BIDI +GNUTLS +ICU +SYSTEMD
Helix Version
helix 22.05-dev (35d2693)
The text was updated successfully, but these errors were encountered: