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

expected a borrowed string for key with backslash in key binding #5144

Closed
ds-cbo opened this issue Dec 13, 2022 · 1 comment · Fixed by #5185
Closed

expected a borrowed string for key with backslash in key binding #5144

ds-cbo opened this issue Dec 13, 2022 · 1 comment · Fixed by #5185

Comments

@ds-cbo
Copy link
Contributor

ds-cbo commented Dec 13, 2022

Breaking version: helix 22.12 (0f2ae35a)
This worked fine in 22.08

Config:

[keys.normal]
"3" = [
  ":pipe sed -E 's/\\s+$//g'"
]

Command:
./target/debug/hx --config /tmp/config.toml -vvv --log /tmp/helix.log

Error:

Bad config: invalid type: string ":pipe sed -E 's/\\s+$//g'", expected a borrowed string for key `keys.normal.3` at line 3 column 3

This seems to be caused by the double backslash in the command. Replacing it with :pipe sed -E 's/ +$//g' fixes the issue for now.

Log:

Nothing interesting
2022-12-13T10:27:43.585 helix_loader [DEBUG] Located configuration folders: ["/Users/me/vendor/helix/.helix"]
2022-12-13T10:27:43.642 helix_view::clipboard [DEBUG] Using pbcopy+pbpaste to interact with the system clipboard
2022-12-13T10:27:43.642 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE | WRITABLE
2022-12-13T10:27:43.642 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
2022-12-13T10:27:43.642 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE
2022-12-13T10:27:43.642 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE
2022-12-13T10:27:43.643 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-13T10:27:44.038 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-13T10:27:44.145 helix_term::commands::typed [DEBUG] quitting...
2022-12-13T10:27:44.145 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-13T10:27:44.235 helix_term::commands::typed [DEBUG] quitting...
2022-12-13T10:27:44.235 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-13T10:27:44.235 helix_term::job [DEBUG] waiting on jobs...
2022-12-13T10:27:44.235 helix_term::job [DEBUG] waiting on jobs...
2022-12-13T10:27:44.237 mio::poll [TRACE] deregistering event source from poller
2022-12-13T10:27:44.237 mio::poll [TRACE] deregistering event source from poller

System:

rustc 1.65.0 (897e37553 2022-11-02)
cargo 1.65.0 (4bc8f24d3 2022-10-20)
Darwin 22.1.0, arm64 (macOS 13.0.1 on M1 chip)
gibbz00 added a commit to gibbz00/helix that referenced this issue Jan 23, 2023
* Fix failing integration testing
* Fix bug in which which local directories were being tested for their
  existence.
* Fixes helix-editor#5144
* Ran cargo fmt
gibbz00 referenced this issue Jan 25, 2023
The new version of the `toml` crate is based on `toml_edit` and does
not support zero copy deserialization anymore. So we need to deserialize
`String` instead of `&str` in the keympa
@pascalkuthe
Copy link
Member

This is fixed by e83ce72 but this particular keymap doesn't actually work regardless because helix performs some additional escapes (even when typing the same keymap inside helix). I found :pipe \\'\\s+/,/g\\' to work when typed into helix but not as a keymap (rI tried a bunch of extra escapes but didn't manage it, the command doesn't even get dispatched). Not too sure how to fix that tough and I think that's (partially) intentional and not what this issue is about. #5144 is more or less the same fix as e83ce72 tough (there is nothing additional there which would fix the behavior I described)

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

Successfully merging a pull request may close this issue.

2 participants