Skip to content

Allow jumping between words on the input line #71

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DjMorgul
Copy link

@DjMorgul DjMorgul commented Oct 5, 2024

Allow jumping between words on the input line when the focus is on it, with key combinations 'Command + Left' and 'Command + Right', instead of collapsing or expanding the channel list for the current server.

The later bindings were taking precedence even when the focus was on the input line (the BTextView to type IRC messages the user wants to send).

With the changes on this commit, when the focus is on the input line, these key combinations correctly move to the start of the current word or the previous word, or to the end of the current word or the next word. And when the focus is anywhere else, the behavior before this commit is replicated.

And the combinations 'Command + Shift + Left' and 'Command + Shift + Right' were also done to work correctly, moving the selection on the input line between words.

As the operation of expanding the channel list is harmless to the user (it will keep showing the server messages), and the collapse operation opens the server messages screen; changes the focus to the input line and moves its cursor to its end, 'Command + Right' will also expand the channel list if the cursor is at the end of the input line. This way the operation of collapsing the channel list can be intuitively undone by pressing 'Command + Right' right afterwards.

The opposite WAS NOT implemented, i.e. collapsing the channel list with 'Command + Left' when the cursor is at the start of the input line, because the collapsing operation hides the current channel messages (it's not harmless to the user's workflow).

when the focus is on it, with key combinations 'Command + Left' and 'Command + Right', instead of collapsing or expanding the channel list for the current server.

The later bindings were taking precedence even when the focus was on the input line (the BTextView to type IRC messages the user wants to send).

With the changes on this commit, when the focus is on the input line, these key combinations correctly move to the start of the current word or the previous word, or to the end of the current word or the next word. And when the focus is anywhere else, the behavior before this commit is replicated.

And the combinations 'Command + Shift + Left' and 'Command + Shift + Right' were also done to work correctly, moving the selection on the input line between words.

As the operation of expanding the channel list is harmless to the user (it will keep showing the server messages), and the collapse operation opens the server messages screen; changes the focus to the input line and moves its cursor to its end, 'Command + Right' will also expand the channel list if the cursor is at the end of the input line. This way the operation of collapsing the channel list can be intuitively undone by pressing 'Command + Right' right afterwards.

The opposite WAS NOT implemented, i.e. collapsing the channel list with 'Command + Left' when the cursor is at the start of the input line, because the collapsing operation hides the current channel messages (it's not harmless to the user's workflow).
@waddlesplash
Copy link
Member

Rather than adding special logic here, maybe we should just remove these shortcuts entirely? Are they even used? CC @humdingerb.

If we are going to keep them when the text view isn't selected, then this code could definitely be cleaned up.

@humdingerb
Copy link
Member

IMO both menu items to expand/collapse the "network list" (the actual outlinelist is weirdly labeled "Window list"...) do not need a shortcut. I've never used that shortcut, but always was annoyed the system wide ALT+left/right doesn't work when writing.

The menu items themselves aren't needed when we remove the shortcuts then at all IMO.

@humdingerb
Copy link
Member

nephele on IRC pointed out that instead of those two menus there could be one: "Expand/collapse network" with one shortcut, e.g. ALT+E.
I think that's a good idea.

@DjMorgul
Copy link
Author

DjMorgul commented May 17, 2025

BTextView word-wise jump is currently broken from commit hrev58589. It took away the option to navigate between words with Alt+left or right, making it go to the beginning or end of the line (pointlessly because that's what Home and End keys are for), it changed it to Option+left or right, which will only work if Vision isn't stacked to other windows.

I had ready updated and rebased patches for this pull request, equivalent to what I did (on my fork's branch old_solution), and an alternative patch applying the other solution proposed (on branch new_solution). But it will be useless as long as BTextView misbehaves like that.

@waddlesplash
Copy link
Member

I am not sure that change to Haiku was a good idea then. CC @jscipione, @humdingerb, any thoughts on how we should change that?

@waddlesplash
Copy link
Member

Appears there's discussion about this at https://dev.haiku-os.org/ticket/9913

@jscipione
Copy link
Member

Note that you may also use Ctrl+Left/Right to go to beginning of the line since Alt+Left/Right is taken. Option being taken by Stack and Tile when window is stacked is a larger issue addressed by: #9431 and https://review.haiku-os.org/c/haiku/+/7294 affecting Pe and Eddie and other apps that use option for word-wise navigation.

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

Successfully merging this pull request may close these issues.

4 participants