helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.69k stars 2.5k forks source link

Incoherent cursor position after `search_next` #11659

Closed fhchl closed 2 months ago

fhchl commented 2 months ago

Summary

When searching in the current buffer, the position of the cursor after search_next seems to depend on whether or not one was in insert mode just before:

This is confusing. Let's say one does a search and wants to apply a macro for some of the matches. Then the macro might behave differently depending on history!

Is this desired behavior?

Reproduction Steps

See the recording here: https://asciinema.org/a/Gt68H1eCt2sX110fsHETQC2rS

Helix log

No response

Platform

Linux

Terminal Emulator

kitty 0.35.2

Installation Method

source and binary from release page

Helix Version

24.07-155-g6309cc71

pascalkuthe commented 2 months ago

this has nothing to do with insert-mode. Searching preserves selection direction. Section direction is a general property of of selections work in helix and not specifically related to insertmode (for example if entering insert-mode with a the selection direction is forward). We are considering some changes to the search commands that may change this in the future. Currently the behaviour matches kakoune and is definitely intentional.