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

Opt-in Esc+n 'like-in-mc' input hack #2317

Closed
unxed opened this issue Jul 29, 2024 · 4 comments
Closed

Opt-in Esc+n 'like-in-mc' input hack #2317

unxed opened this issue Jul 29, 2024 · 4 comments

Comments

@unxed
Copy link
Contributor

unxed commented Jul 29, 2024

Mac users have problems with Fn keys, its not easy to use them in far2l. They often ask for special mode then Esc and numeric key pressed simultaneously emulate Fn keys.

But even in mc this feature doesn't work reliable. It requires saving a number after Esc or after several consecutive Escs, and then canceling these Escs.

I suggest considering other possible solutions:

  1. Like with *, + and - keys, map 1..0 to F1..F10 if command line is empty (if --mapnumkeys, for example, is specified)
  2. Map Alt+Shift+n to Fn. This combinations are quite non-intuitive and probably will never be used for any other goal
@akruphi
Copy link
Contributor

akruphi commented Jul 29, 2024

Проблема слабоактуальная - для случая урезанных клавиатур без ряда f1...f10 и для людей привыкших в Midnight Commander к традиционному Esc+цифра, всплывала несколько раз, например цитата из #814 (comment)

режим "как в Midnight Commander" - клацание через Esc + кнопка, например Esc+1 = F1

Также про это в тг-чате раз в десяток месяцев регулярно вопрошает наш майнтейнер, например из
https://t.me/far2l_ru/5617

now the only issue i still have is: i use mac keyboars and f-keys inly work with pressing fn
in mc i use esc-0 for f10

Можно опционально прикрутить по ключику командной строки или параметру в конфиге (но я совсем не понимаю как костылить обработку Esc с ожиданием цифры в текущем коде far2l)?

Такое можно обходить макросами вида

[KeyMacros/Shell/AltShift0]
DisableOutput=0x1
Sequence=F10

но это распальцовка ничем не лучше стандартных Fn+цифра на маковских клавиатурах (маководы поправьте, если в чём ошибаюсь).

@unxed
Copy link
Contributor Author

unxed commented Jul 29, 2024

Problem is still relevant as our Debian maintainer, @alexmyczko, suffers from it. Btw, I am sure like-in-mc solution it is not so hard to implement, I just do not know how to do it in best way. It's better for @elfmz to choose place of the code in which it should be done, and proper method of handling with minimum false-negative and false-positive cases possible.

@unxed
Copy link
Contributor Author

unxed commented Jul 29, 2024

Actually, putting

[KeyMacros/Common/Alt1]
Sequence=F1

[KeyMacros/Common/Alt2]
Sequence=F2

[KeyMacros/Common/Alt3]
Sequence=F3

[KeyMacros/Common/Alt4]
Sequence=F4

[KeyMacros/Common/Alt5]
Sequence=F5

[KeyMacros/Common/Alt6]
Sequence=F6

[KeyMacros/Common/Alt7]
Sequence=F7

[KeyMacros/Common/Alt8]
Sequence=F8

[KeyMacros/Common/Alt9]
Sequence=F9

[KeyMacros/Common/Alt0]
Sequence=F10

in

~/.config/far2l/settings/key_macros.ini

solves an issue: Alt+x is equal to Esc x in terminals

You should press Esc+x relatively fast, but mc behavior is just the same. After some experiments, I realized that in mc Alt+x also performs the same action as the corresponding Fx button, so they are probably using just the same method.

@unxed unxed closed this as completed Jul 29, 2024
@unxed
Copy link
Contributor Author

unxed commented Jul 30, 2024

[KeyMacros/Common/Alt1]
Sequence=F1

The only limitation is that this trick will not work in iTerm2 as it has own extended input mode in which Alt + n is not equal to Esc + n. We probably should add command line switch to optionally disable that extended input mode, see #2320.

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

2 participants