ovk / clcalc

Advanced web-based command-line style calculator
https://clcalc.net
MIT License
40 stars 3 forks source link

Shortcut suggestions #107

Open GlorifiedPig opened 1 year ago

GlorifiedPig commented 1 year ago

Shift+Left Arrow, Shift+Right Arrow should select/deselect one character at a time. Ctrl+A, Ctrl+Shift+Left Arrow, Ctrl+Shift+Right Arrow are all commonly used shortcuts to select or deselect text. Ctrl + Backspace is a commonly used shortcut to delete an entire word at once.

GlorifiedPig commented 1 year ago

Seems like some of these were implemented natively in jquery.terminal, perhaps just needs to be updated.

jcubic commented 1 year ago

I don't think they are added to the library. They may be common for GUI Text editors but not for Terminals. That's why CTRL+A jumps to the beginning of the text. But you can add your own shortcuts with keymap and change that.

GlorifiedPig commented 1 year ago

I don't think they are added to the library. They may be common for GUI Text editors but not for Terminals. That's why CTRL+A jumps to the beginning of the text. But you can add your own shortcuts with keymap and change that.

Would you be comfortable if I do that and make a pull request, or would you prefer this project stay true to terminal shortcuts?

jcubic commented 1 year ago

I don't want to change jQuery Terminal shortcuts. There is already CTLR+A that jumps to the beginning of the line like on a real terminal. I don't want to make jQuery Terminal like other editors.

But as I said you don't need to modify my project to use whatever shortcuts you want.

jcubic commented 1 year ago

Just realized that clcalc is not your project. Sorry about that. You can ask the maintainers of this project if they want the shortcuts added. And they can add them here.

GlorifiedPig commented 1 year ago

Just realized that clcalc is not your project. Sorry about that. You can ask the maintainers of this project if they want the shortcuts added. And they can add them here.

Oh my bad, I thought you were the maintainer of clcalc, I should've paid more attention 😅

I'll re-open the issue and see what they say.

ovk commented 1 year ago

Thanks for the suggestion, @GlorifiedPig.

As @jcubic mentioned, jquery.terminal uses Emacs-style shortcuts that are more or less standard on unix shells. And since clcalc attempts to provide experience somewhat similar to unix terminal, I think those shortcuts are sensible (and familiar to many) default.

However, you made a valid point that those other shortcuts are also ubiquitous in text editors (or just text fields), and thus could be more familiar to some people. So I think the ideal solution would be to add "shortcut style" setting to clcalc, which would allow choosing between "Emacs-style" and that other style (not sure how best to call it) shortcuts. I can try to implement it once I have some free time.