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

:w changes state of buffer to 'saved' even if write failed #2518

Closed
nekodjin opened this issue May 20, 2022 · 0 comments · Fixed by #2267
Closed

:w changes state of buffer to 'saved' even if write failed #2518

nekodjin opened this issue May 20, 2022 · 0 comments · Fixed by #2267
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@nekodjin
Copy link

Summary

The command :w will change the state of a file to 'saved' (removing the [+] symbol), even if the write did not succeed. Because the :q command checks this state before exiting (to prevent losing unsaved work), this bug can cause the :wq command to appear to write and exit successfully when no file was written and all work was lost. The most common cause of a write failing (in my experience) is if the file path includes a directory that does not exist.

Reproduction Steps

Open helix on a file whose path contains nonexistent directories, like this:

hx these/dirs/dont/exist.txt

Write some text. Use the command :w. Note that while an error message is displayed, the "change indicator" ([+]) has disappeared. Write some more text. Use the command :wq. Helix will appear to write and exit successfully, but the specified file will not have been created.

Helix log

No response

Platform

Linux

Terminal Emulator

WinTerm (WSL2)

Helix Version

helix 22.05-dev (29121a1)

@nekodjin nekodjin added the C-bug Category: This is a bug label May 20, 2022
@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label May 20, 2022
@the-mikedavis the-mikedavis linked a pull request May 20, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants