-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Open
Labels
C-bugCategory: This is a bugCategory: This is a bug
Description
Summary
See the discussion in
I was trying to define a key to emulate Emacs fill-paragraph (c.f. discussion).
Reproduction Steps
Consider this example:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor
incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat.
Quis
aut[e]
iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
I want to :reflow this text, but preserve the cursor position which is indicated above with [e] in aut[e].
- Let's hit
C-sfirst to triggersave_selection. - Let's type
mipto select the entire paragraph:
[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor
incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat.
Quis
aute
iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.]
- Let's type
:reflow:
[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor
incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis
aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.]
- Let'ts type
C-o/jump-backwardto restore the saved selection from the jump-list:
[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor
incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis
aut]e iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.
Ooops! This restored a selection that never existed in the first place! Granted, it is sort of possible to work around this by swapping head and anchor with A-;. Nevertheless, it is almost certainly a bug. It shows up in surprising ways, for example a macro to emulate Emacs' fill-paragraph function is not symmetrical between normal and insert mode:
[keys.normal]
A-q = "@<C-s>mip:reflow<ret><C-o><A-;>l"
[keys.insert]
A-q = "@<esc><C-s>mip:reflow<ret><C-o>li"
The above mentioned discussion has a few more details.
Helix log
~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines
Platform
macOS
Terminal Emulator
alacritty
Installation Method
brew
Helix Version
helix 25.07.1 (a05c151)
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bugCategory: This is a bug