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

:write produces a phantom change after two character keybinding (from either normal or insert mode) #9322

Closed
briandorsey opened this issue Jan 12, 2024 · 2 comments
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@briandorsey
Copy link
Contributor

briandorsey commented Jan 12, 2024

Summary

After running :write from a two character keybinding, it produces a phantom change (from either normal or insert mode)

It seems to depend somewhat on what kind of change I make. If I press O to create a newline, and save, it happens. d to delete a line then save, it doesn't. It appears to be consistent, related to the kinds of changes.

FWIW, I think this is different than #2192, since it happens from both normal and insert mode.

Reproduction Steps

I tried this:

In my config, I have the following keybindings:

[keys.insert.";"]
a = "normal_mode"
w = ["normal_mode", ":w"]

[keys.normal.";"]
a = "no_op"
w = ":write"

After making any change, I hit the ; key followed by w.

I expected this to happen:
File written.

Instead, this happened:
The file is written, however the "unsaved" plus flag remains.
ex:

 NOR   ~/.config/helix/config.toml [+]                                     1 sel  4:1
'~/.config/helix/config.toml' written, 36L 665B

Hitting the same key series again right afterwards will save the file again and this time remove the flag.

Helix log

~/.cache/helix/helix.log

Log of opening Helix, O to create new line then ;, then w.

2024-01-11T23:18:21.379 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2024-01-11T23:18:21.446 helix_view::document [DEBUG] submitting save of doc 'Some("/Users/brian/.config/helix/config.toml")'
2024-01-11T23:18:21.447 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2024-01-11T23:18:21.447 helix_term::application [DEBUG] received editor event: DocumentSaved(Ok(DocumentSavedEvent { revision: 1, doc_id: DocumentId(1), path: "/Users/brian/.config/helix/config.toml", text: ["[editor]\n\nauto-pairs = false\nsoft-wrap.enable = true\n\n\n[keys.insert]\n# up = \"no_op\"\n# down = \"no_op\"\n# left = \"no_op\"\n# right = \"no_op\"\npageup = \"no_op\"\npagedown = \"no_op\"\nhome = \"no_op\"\nend = \"no_op\"\n\n[keys.insert.\";\"]\na = \"normal_mode\"\nw = [\"normal_mode\", \":w\"]\n# \";\" = \":append-output /bin/echo -n \\\";\\\"\"\n\n[keys.normal]\nZ = { Q = \":quit!\", Z = \":write-quit-all\" }\nC-j = \":buffer-next\"\nC-k = \":buffer-previous\"\n\n# Search for word under cursor\n\"*\" = [\"move_char_right\", \"move_prev_word_start\", \"move_next_word_end\", \"search_selection\", \"search_next\"]\n\n[keys.normal.\";\"]\na = \"no_op\"\nw = \":write\"\n# \";\" = \"collapse_selection\"\n\n[editor.lsp]\ndisplay-inlay-hints = true\n"] }))
2024-01-11T23:18:21.447 helix_term::application [DEBUG] document Some("/Users/brian/.config/helix/config.toml") saved with revision 1
2024-01-11T23:18:21.447 helix_view::document [DEBUG] doc 1 revision updated 0 -> 1
2024-01-11T23:18:21.447 helix_lsp::file_event [DEBUG] Received file event for "/Users/brian/.config/helix/config.toml"
2024-01-11T23:18:21.447 helix_view::editor [DEBUG] editor status: '~/.config/helix/config.toml' written, 37L 666B
2024-01-11T23:18:21.447 helix_view::document [DEBUG] id 1 modified - last saved: 1, current: 1
2024-01-11T23:18:21.698 helix_term::application [DEBUG] received editor event: IdleTimer
2024-01-11T23:18:23.123 helix_view::document [DEBUG] id 1 modified - last saved: 1, current: 1
2024-01-11T23:18:23.251 helix_view::document [DEBUG] id 1 modified - last saved: 1, current: 1
2024-01-11T23:18:23.251 helix_term::job [DEBUG] waiting on jobs...
2024-01-11T23:18:23.251 helix_view::document [DEBUG] id 1 modified - last saved: 1, current: 1
2024-01-11T23:18:23.251 helix_term::job [DEBUG] waiting on jobs...

Platform

macOS

Terminal Emulator

iTerm

Installation Method

brew

Helix Version

helix 23.10 (f6021dd)

@briandorsey briandorsey added the C-bug Category: This is a bug label Jan 12, 2024
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Jan 23, 2024
@pascalkuthe
Copy link
Member

The normal mode keybinding works, the insert binding does not work and will even cause crashes.

@pascalkuthe
Copy link
Member

Duplicate of #3501

@pascalkuthe pascalkuthe marked this as a duplicate of #3501 Apr 2, 2024
@pascalkuthe pascalkuthe closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2024
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

No branches or pull requests

3 participants