isamert / scli

a simple terminal user interface for signal messenger (using signal-cli)
GNU General Public License v3.0
448 stars 39 forks source link

Navigate contacts with J, K #106

Closed AckslD closed 3 years ago

AckslD commented 3 years ago

Would be great if one could navigate contacts panel with capital J, K :)

exquo commented 3 years ago

Do you mean: while the focus is in the conversation pane, to change the current (opened) conversation with J/K, without having to press Tab to move to the contacts pane? Or make those keys do what g/G do (go to the top / bottom)?

AckslD commented 3 years ago

The first one, i.e. without having to press Tab. I'm using aerc for mail where J/K goes to next/previous folder and I keep noticing that I try to do the same when I'm using scli.

exquo commented 3 years ago

Yes, this can be added. While the focus is on the chat messages, pressing J/K will change the opened chat and keep the focus in the (new) messages list.

AckslD commented 3 years ago

I was just wondering now actually if different keys would be better such as ctrl+j/ctrl+k or ctrl+n/ctrl+p since they could perhaps then also be used if focus is in the input-field.

exquo commented 3 years ago

That's a good point.

The Ctrl+n/p combos would be claimed in the upcoming version for moving up and down the messages list when chat is in focus, and for cycling through commands history when the input line is in focus. (WIP)

The Ctrl+j/k should be a good alternative. It's not currently used for anything, and cycling through contacts' chats seems like the most natural assignment for it.

Maybe also J/K can be added for good measure, but will have effect only when the messages list is in focus, as above.

EDIT: oops, turns out Ctrl+j is interpreted by terminal emulators as Enter. This is the same limitation in terminals as in https://github.com/isamert/scli/issues/92#issuecomment-729665237, nothing we can do here. So will need to pick a different key combo. Maybe Alt+j/k? Another option: Alt+Up/Down, this is what signal-desktop uses.

AckslD commented 3 years ago

Alt+j/k sounds good to me 👍 Although the optimal would be if that could be configured by the user :)

Regarding the issue with ctrl+j btw, is that only in certain terminal emulators? I'm using ctrl+j in vim without issues (kitty+zsh)

exquo commented 3 years ago

Good call about user-configurable key bindings, I've opened a new issue for that: #107

Turns out technically there is a distinction between key events for Enter and CtrlJ: they produce 'Carriage return' and 'Line feed' respectively.

<CR> or carriage return, technically used to mean go to the start of the line. <NL>, or newline aka line feed (usually called LF), was used to mean go to the next line. Over time, the distinction was lost in most applications.1 Pressing Enter actually yields a carriage return, usually (try pressing CtrlVEnter - you should see ^M in Unix terminals). <NL>'s control code is CtrlJ.

https://vi.stackexchange.com/questions/4246/what-is-the-difference-between-j-ctrl-j-nl-and-ctrl-n-in-normal-mode/4249#4249

It's all the same to urwid though: enter is reported for both.

AckslD commented 3 years ago

Good call about user-configurable key bindings, I've opened a new issue for that: #107

Great 🙂

Turns out technically there is a distinction between key events for Enter and CtrlJ: they produce 'Carriage return' and 'Line feed' respectively.

<CR> or carriage return, technically used to mean go to the start of the line. <NL>, or newline aka line feed (usually called LF), was used to mean go to the next line. Over time, the distinction was lost in most applications.1 Pressing Enter actually yields a carriage return, usually (try pressing CtrlVEnter - you should see ^M in Unix terminals). <NL>'s control code is CtrlJ.

https://vi.stackexchange.com/questions/4246/what-is-the-difference-between-j-ctrl-j-nl-and-ctrl-n-in-normal-mode/4249#4249

It's all the same to urwid though: enter is reported for both.

I see!

exquo commented 3 years ago

Implemented in this (alpha) branch. To be merged in 'mainline' soon.