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

Make Alt+F forward a word again #1580

Closed
rfc-2549 opened this issue Jul 15, 2021 · 14 comments
Closed

Make Alt+F forward a word again #1580

rfc-2549 opened this issue Jul 15, 2021 · 14 comments
Assignees
Labels
behaviour-change changes to current behaviour
Milestone

Comments

@rfc-2549
Copy link

Expected Behavior

The input moves to the next word (Like in emacs and most shells)

Current Behavior

It sets the attention flag

Possible Solution

Configure keybindings

Steps to Reproduce (for bugs)

  1. Press Alt + F while writing a message with more than 2 words
@jubalh
Copy link
Member

jubalh commented Jul 16, 2021

I totally forgot about usual readline shortcuts since I never use them.
We should make sure not to overwrite the most default ones (that make sense) probably: https://readline.kablamo.org/emacs.html

@jubalh jubalh added this to the 0.11.1 milestone Jul 17, 2021
@jubalh
Copy link
Member

jubalh commented Jul 20, 2021

So what would be good alternatives for the key combos?

alt-f flag window as marked
alt-m - switch between marked windows

alt-a marking as unread

I'm tempted to just let them stay as they are since I guess all the readline combos can also be done with ctrl+arrow keys. And we probably want short key combos for the marking/switching between windows.

@rfc-2549
Copy link
Author

Well, if it will be less pain for you, leave them like that. Altough i'd like it to be possible to use Alt+f again

@jubalh
Copy link
Member

jubalh commented Jul 20, 2021

It's not hard to change to code to use another binding.
We just need to have a good idea with letters that make sense and at the same time not use default readline letters :/

Do you have sugestions?

@rfc-2549
Copy link
Author

Hm, well I think Alt-n doesn't make sense but it is near m so you can quickly press Alt-n and Alt-m?

@jubalh
Copy link
Member

jubalh commented Jul 22, 2021

What about the others though?

@4drift
Copy link

4drift commented Aug 6, 2021

I agree with alt+n as it is convenient. I am greatly displeased by having alt+f gone as I use it to jump words ever constantly and ctrl+arrows doesn't even work for me.

Besides it is terribly inconvenient compared to alt+f/b -- I use it in the terminal constantly too. I'd think more people would have a problem with this binding being taken over. Having a memorable letter just isn't reason enough to overwrite a default terminal binding.

@jubalh
Copy link
Member

jubalh commented Aug 7, 2021

I am greatly displeased by having alt+f gone as I use it to jump words ever constantly

We don't need to know about this. The original poster said this already.

and ctrl+arrows doesn't even work for me.

Then fix your setup.

Having a memorable letter just isn't reason enough to overwrite a default terminal binding.

alt+f is not a "default terminal binding". Actually it has nothing to do with your terminal. It's the default binding for GNU Readline in emacs mode.
If we would have not chosen to use the readline library then this terminal wouldn't work out of the box at all. Like is the case for many applications out there.

Now with this being clarified I would again ask for alternative keybinding suggestions. The change is not big, just one/two lines that need to be changed. But someone will have to come up with an alternative binding.

@allora
Copy link

allora commented Aug 12, 2021

We don't need to know about this. The original poster said this already.

TBH its useful to know how many folks use some (seemingly very common and probably default in some cases) bindings. I Also would prefer profanity to respect this specific binding (atl+f/b).

Then fix your setup.

TBH, not every terminal out there will do ctrl+arrow keys out of the box. Rxvt-Unicode (urxvt) or UXTerm for example. So its not really "fix your setup" since its not always a -default- on every terminal emulator out there. Additionally arrow keys are highly inconvenient.

alt+f is not a "default terminal binding". Actually it has nothing to do with your terminal. It's the default binding for GNU Readline in emacs mode.

No need to be pedantic :P I think we get the gist of the comment.

Now with this being clarified I would again ask for alternative keybinding suggestions. The change is not big, just one/two lines that need to be changed. But someone will have to come up with an alternative binding.

I think you missed the part where he said alt+n is convenient. It was at the beginning. And I will second that suggestion.

On the flip side, down the road a better solution to trying to avoid conflicting bindings in who knows how many different terminal emulators people use, would be to let folks customize the bindings them selves. But that is def a bigger task than just changing some hard coded values :)

@jubalh
Copy link
Member

jubalh commented Aug 16, 2021

So this is what's going to happen:
Someone will go through the list of keybindings in profanity and through the list of default keybindings from readline (mentioned in #1580 (comment)) and will propose the changes here with explanation why they make sense. If noone can do it, then it will stay like it is.

@jubalh
Copy link
Member

jubalh commented Aug 20, 2021

We only need to change alt+f all the rest is okay? Did someone check?
We could use alt+v instead of alt+f.
Reasons:

  • v is close enough on keyboard to the f
  • f and v sound similar so we could still say "vlag" ;)
  • v seems free?

@cockroach
Copy link
Contributor

v sounds like a good alternative to me

@4drift
Copy link

4drift commented Aug 31, 2021

Some alt bindings are not implemented: alt+c, alt+u, alt+l, and alt+t it seems. I'm not sure where I got this list now, but these were once given as a reference for the main bindings to me.

Alt + BackSpace to delete to a separator/delimitor!
Ctrl + a – go to the start of the command line
Ctrl + e – go to the end of the command line
Ctrl + k – delete from cursor to the end of the command line
Ctrl + u – delete from cursor to the start of the command line
Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
Ctrl + xx – move between start of command line and current cursor position (and back again)
Alt + b – move backward one word (or go to start of word the cursor is currently on)
Alt + f – move forward one word (or go to end of word the cursor is currently on)
Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + c – capitalize to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + u – make uppercase from cursor to end of word
Alt + l – make lowercase from cursor to end of word
Alt + t – swap current word with previous
Ctrl + f – move forward one character
Ctrl + b – move backward one character
Ctrl + d – delete character under the cursor
Ctrl + h – delete character before the cursor
Ctrl + t – swap character under cursor with the previous one

Ctrl + l – clear the screen
Ctrl + s – stops the output to the screen (for long running verbose command)
Ctrl + q – allow output to the screen (if previously stopped using command above)
Ctrl + c – terminate the command
Ctrl + z – suspend/stop the command

I don't think EVERY single readline binding has bearing on this discussion. I would think the movement ones are the ones most important?

jubalh added a commit that referenced this issue Aug 31, 2021
alt+f is the default readline shortcut for forward one word.

Regards #1580
@jubalh
Copy link
Member

jubalh commented Aug 31, 2021

Switched alt-f to alt-v. Hope everybody is happy now :)
0.11.1 will have this.

@jubalh jubalh closed this as completed Aug 31, 2021
@jubalh jubalh self-assigned this Aug 31, 2021
@jubalh jubalh added behaviour-change changes to current behaviour and removed discussion labels Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behaviour-change changes to current behaviour
Projects
None yet
Development

No branches or pull requests

5 participants