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

consider switching from Alt-X to Ctrl-X as exit hotkey #58

Open
unxed opened this issue Mar 3, 2023 · 7 comments
Open

consider switching from Alt-X to Ctrl-X as exit hotkey #58

unxed opened this issue Mar 3, 2023 · 7 comments

Comments

@unxed
Copy link
Contributor

unxed commented Mar 3, 2023

If you are using more then one keyboard layout, to exit turbo you should:

  1. Look what keyboard layout is currently selected
  2. Switch to Latin layout if non-Latin is selected
  3. Press Alt-X

Too complicated path for the most frequently used hot key.

But Ctrl key combinations are working in any keyboard layout (both in GNOME Terminal and in far2l tty extensions mode). So maybe it's a good idea to switch to Ctrl-X as exit key combination? Also all other character-based hotkeys are already using Ctrl, so it would be consistent to use Ctrl for exit hot key also.

If Alt-X is needed for compatibility with old good Turbo Vision, both combinations may be enabled at the same time.

We may also just use Esc as intuitive exit hot key because it is not used currently in plain edition mode.

@unxed
Copy link
Contributor Author

unxed commented Mar 3, 2023

Currently I am using this hack to be able to open menu on pressing something like Alt+F in non-Latin keyboard layouts. Not ideal, but you can use arrow keys to navigate after it at least. And at least Alt+non-latin-letter stops putting chars in editor after it.

diff --git a/source/platform/far2l.cpp b/source/platform/far2l.cpp
--- a/source/platform/far2l.cpp
+++ b/source/platform/far2l.cpp
@@ -78,6 +78,13 @@ ParseResult parseFar2lInput(GetChBuf &buf, TEvent &ev, InputState &state) noexce
             memcpy(&kev.dwControlKeyState, &out[6],  4);
             memcpy(&kev.uChar.UnicodeChar, &out[10], 4);
 
+            if ((kev.dwControlKeyState == 2) && (kev.uChar.UnicodeChar > 255)) {
+                // simulate "open menu" hotkey
+                // to get into menu then trying to use menu hotkey on non-latin kb layouts
+                kev.dwControlKeyState = 0;
+                kev.wVirtualKeyCode = VK_F12;
+            }
+
             if (uint16_t keyCode = virtualKeyCodeToKeyCode[kev.wVirtualKeyCode])
             {
                 kev.wVirtualScanCode = keyCode >> 8;

@magiblot
Copy link
Owner

magiblot commented Mar 4, 2023

Hi @unxed!

You are right, I hadn't considered this case.

Of course, Ctrl+X shall remain assigned to Cut. The whole point of Turbo is to make it user-friendly for people used to GUI editors. Taking this into account, the shortcut for Close should then be Ctrl+Q. We will have to find a new shortcut for Toggle Comment, though, which is currently assigned to Ctrl+Q.

@unxed
Copy link
Contributor Author

unxed commented Mar 4, 2023

Also, what about switching from F12 to F9 as menu activation hot key? It's used by Norton Commander, Midnight Commander, Far Manager. Quite popular programs, so users do not have to relearn.

@unxed
Copy link
Contributor Author

unxed commented Mar 4, 2023

Another idea: pressing Ctrl+W with no open editor windows may mean "exit turbo".

@magiblot
Copy link
Owner

I have added Ctrl+Q as a shortcut for Exit (Alt+X is still valid) and Toggle Comment is now assigned to Ctrl+E (like Geany). In addition, Toggle Comment can now also be triggered by Ctrl+_, which in most terminal emulators is mapped to Ctrl+/.

I might consider the other suggestions in the future.

@unxed
Copy link
Contributor Author

unxed commented Mar 19, 2023

About Alt+char hot keys not working in non-Latin layouts: found possible solution at least then working in far2l extensions mode. Needs to be implemented on both far2l and turbo sides. See elfmz/far2l#1562

@JorisHansMeijer
Copy link

Some related suggestion:
Many terminal applications use F10 as exit (example htop, midnight commander).
I would like to propose using F10 as exit for turbo as well.

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

No branches or pull requests

3 participants