linutil icon indicating copy to clipboard operation
linutil copied to clipboard

🦀 allow exiting out of search mode with `Ctrl-C`

Open adamperkowski opened this issue 1 year ago • 20 comments

Type of Change

  • [x] UI/UX improvement

Description

Added an option to abort the search with Ctrl-C and fixed up the shortcut tooltip a bit.

Testing

Works perfectly.

Checklist

  • [x] My code adheres to the coding and style guidelines of the project.
  • [x] I have performed a self-review of my own code.
  • [x] My changes generate no errors/warnings/merge conflicts.

adamperkowski avatar Oct 05 '24 13:10 adamperkowski

Ctrl C must be used only for exiting the application. Ctrl C is generally used when the application is misbehaving. I am against this change

jeevithakannan2 avatar Oct 05 '24 17:10 jeevithakannan2

Ctrl C must be used only for exiting the application. Ctrl C is generally used when the application is misbehaving. I am against this change

why?

ghost avatar Oct 05 '24 17:10 ghost

Ctrl C must be used only for exiting the application. Ctrl C is generally used when the application is misbehaving. I am against this change

vim, nano, helix, mysql, midnight commander, cmus, fzf

just off the top of my head. those tools utilize Ctrl C for their functionality. Ctrl C is not generally used when the application is misbehaving. That's Ctrl D. I'm sorry but you're wrong here.

adamperkowski avatar Oct 05 '24 17:10 adamperkowski

Ctrl C is generally used when the application is misbehaving.

...

jeevithakannan2 avatar Oct 05 '24 17:10 jeevithakannan2

Ctrl C is generally used when the application is misbehaving.

...

its an exit command like the rest in linutil e.g. q esc, by your logic we should limit q & esc down to exiting linutil as well

ghost avatar Oct 05 '24 17:10 ghost

No they are generally used for exiting for example closing other parts of an application also. But Ctrl c is more specific it is only used to close when the app is not responding, etc...

jeevithakannan2 avatar Oct 05 '24 17:10 jeevithakannan2

i got more:

more, less, man, tldr, gitui, bmon

adamperkowski avatar Oct 05 '24 17:10 adamperkowski

Have you ever used an app that provides Ctrl c to close menus or exit search ?

jeevithakannan2 avatar Oct 05 '24 17:10 jeevithakannan2

No they are generally used for exiting for example closing other parts of an application also. But Ctrl c is more specific it is only used to close when the app is not responding, etc...

That's not true. Do you even use TUI tools? Just look at vim.

adamperkowski avatar Oct 05 '24 17:10 adamperkowski

Have you ever used an app that provides Ctrl c to close menus or exit search ?

Yes. linutil (here), vi, vim, nvim, helix, nano, more, less, fzf, i don't even want to type anymore

adamperkowski avatar Oct 05 '24 17:10 adamperkowski

htop, btop, top they use them to exit their application not exit the search. Vi, vim, nvim does the opposite they close with q instead and to force quit ctrl c is used ( if configured ). More, less also don't give the functionality to exit the search with ctrl c

jeevithakannan2 avatar Oct 05 '24 17:10 jeevithakannan2

htop, btop, top they use them to exit their application not exit the search

Oh yeah, sorry was wrong on this one.

Vi, vim, nvim does the opposite they close with q instead

No. Do you know how to use search in vi? I'll give you a tutorial:

  1. type / while in normal mode
  2. search for something
  3. change your mind and hit ctrl c
  4. see that it works

and to force quit ctrl c is used ( if configured ).

if configured...

More, less also don't give the functionality to exit the search with ctrl c

https://github.com/user-attachments/assets/202db4e9-4434-44ad-839c-23e271b1dc87

adamperkowski avatar Oct 05 '24 17:10 adamperkowski

Yeah I mentioned if configured !! to map the CTRL C to exit the application. And still all the other applications you mentioned are wrong. This does not improve the UX. It makes it harder for the user to exit from the application

jeevithakannan2 avatar Oct 05 '24 17:10 jeevithakannan2

Yeah I mentioned if configured !!.

This is not configured !! ctrl c aborts search in vi by default

adamperkowski avatar Oct 05 '24 17:10 adamperkowski

Yeah I mentioned if configured !!.

This is not configured !! ctrl c aborts search in vi by default

Am i not clear ?? If configured it can be used to exit the application with CTRL C

jeevithakannan2 avatar Oct 05 '24 17:10 jeevithakannan2

This does not improve the UX.

I find myself very frustrated having to use esc when I'm used to doing ctrl c. This definitely does improve UX.

It makes it harder for the user to exit from the application

Ctrl C does not exit linutil when in search mode. Test it.

adamperkowski avatar Oct 05 '24 17:10 adamperkowski

This video proves bad UX. You can't argue with that.

https://github.com/user-attachments/assets/a3539ca2-3f1f-416b-9da2-24cb8447d88b

adamperkowski avatar Oct 05 '24 17:10 adamperkowski

Ctrl C does not exit linutil when in search mode. Test it.

Users would want to use CTRL C to exit the application rather than aborting the search in case linutil needs to be force quit. Most of the applications except vi does that out of the box.

jeevithakannan2 avatar Oct 05 '24 17:10 jeevithakannan2

Users would want to use CTRL C to exit the application rather than aborting the search in case linutil needs to be force quit. Most of the applications except vi does that out of the box.

Do you need more examples?

  • mc, ranger - copying files
  • vi, vim etc - exiting modes, aborting commands
  • irssi, weechat, a lot of IRC programs - copying, aborting, changing modes (depends)
  • mutt - copying
  • cmus - a lot of functions, depends

And, by the way, CTRL C does not forcequit linutil. It calls the exit function.

adamperkowski avatar Oct 05 '24 18:10 adamperkowski

in case linutil needs to be force quit.

If an application "needs to be force quit", such as if it's hung or otherwise impossible to exit properly, you can send a SIGKILL with kill -9 $PID or killall -9 $EXECUTABLE_NAME. <C-c> has never served that purpose (SIGINT is voluntarily handled by the application), and a TUI with its own key handling will not receive any signal from that input.

lj3954 avatar Oct 08 '24 06:10 lj3954