Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

repeat_last_motion (Alt+.) with find_next_char (f) does not respect context #7709

Closed
Alexis-Lapierre opened this issue Jul 22, 2023 · 2 comments
Labels
C-bug Category: This is a bug

Comments

@Alexis-Lapierre
Copy link
Contributor

Summary

For helix 23.05, using repeat_last_motion with find_next_char or till_next_char always extended selection.

However this was deemed 'odd' and was fixed in #7159

The behaviour on master (using 23.05-245-g505213d4) is now using "f" will respect the context.
In:

  • normal mode => invoke find_next_char
  • extend mode => invoke extend_next_char

This however have the side effect of storing the "extended-ness" the next time we use Alt-.
This mean that if we type "f" in extended mode to look for something, and then exit back into normal mode, the next Alt-. is till going to extend the selection.
The opposite is also true, typing "f" in normal mode then going into extended mode is going to cancel selection at each Alt-.

Reproduction Steps

On helix 23.05-245-g505213d4

I tried this:

  1. hx some_file_with_text
  2. fCvj<Alt-.>

Here is asciinema of input:

asciicast

I expected this to happen:

Alt-. to extend the selection I made in visual mode

Instead, this happened:

Alt-. cancelled my selection

Helix log

N/A

Platform

Linux - Ubuntu 23.04

Terminal Emulator

kitty

Helix Version

23.05-245-g505213d4

@Alexis-Lapierre Alexis-Lapierre added the C-bug Category: This is a bug label Jul 22, 2023
@Alexis-Lapierre
Copy link
Contributor Author

One easy solution would be to instead having

find_next_char and extend_next_char in helix-term/src/command.rs
be hard-coded extend / not extend

have the underlying function, find_next_char, ask the Context it already have at each call to see if it should extend or not the selection depending on something like Context.editor.mode == Mode::Select

@pascalkuthe
Copy link
Member

This is on purpose. The concept of visual mode as a special mode will be removed entirely in the future. Visual mode will just be a keymap mode, with each command having a an extend and non-extend variant

@helix-editor helix-editor locked and limited conversation to collaborators Jul 22, 2023
@pascalkuthe pascalkuthe converted this issue into discussion #7710 Jul 22, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants