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

🦀 allow exiting out of search mode with Ctrl-C #768

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

adamperkowski
Copy link
Collaborator

Type of Change

  • 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

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

@jeevithakannan2
Copy link
Contributor

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

@nnyyxxxx
Copy link
Contributor

nnyyxxxx commented Oct 5, 2024

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?

@adamperkowski
Copy link
Collaborator Author

adamperkowski commented Oct 5, 2024

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.

@jeevithakannan2
Copy link
Contributor

Ctrl C is generally used when the application is misbehaving.

...

@nnyyxxxx
Copy link
Contributor

nnyyxxxx commented Oct 5, 2024

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

@jeevithakannan2
Copy link
Contributor

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...

@adamperkowski
Copy link
Collaborator Author

i got more:

more, less, man, tldr, gitui, bmon

@jeevithakannan2
Copy link
Contributor

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

@adamperkowski
Copy link
Collaborator Author

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
Copy link
Collaborator Author

adamperkowski commented Oct 5, 2024

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

@jeevithakannan2
Copy link
Contributor

jeevithakannan2 commented Oct 5, 2024

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

@adamperkowski
Copy link
Collaborator Author

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

2024-10-05_19-34-53.mp4

@jeevithakannan2
Copy link
Contributor

jeevithakannan2 commented Oct 5, 2024

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

@adamperkowski
Copy link
Collaborator Author

Yeah I mentioned if configured !!.

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

@jeevithakannan2
Copy link
Contributor

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

@adamperkowski
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

2024-10-05_19-46-09.mp4

@jeevithakannan2
Copy link
Contributor

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.

@adamperkowski
Copy link
Collaborator Author

adamperkowski commented Oct 5, 2024

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.

@lj3954
Copy link
Contributor

lj3954 commented Oct 8, 2024

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.

@ChrisTitusTech ChrisTitusTech merged commit 4f7de59 into ChrisTitusTech:main Oct 24, 2024
1 check passed
@adamperkowski adamperkowski deleted the search_ctrlc branch October 24, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants