tlf
tlf copied to clipboard
Improve keyer: unify key handling and add graceful closing of keyer window
(this is still work in progress, comments are welcome)
My motivation was twofold:
-
provide a single-key alternative to close keyer window without stopping keying. This allows faster typing of additional messages. No need to press Ctrl-K for a graceful exit. The new closing key is ` (grave accent or back tick) that is located below Esc on the US keyboard.
-
allow use of all F-key, Alt-key messages, plus keyer related other keys (speed up/down, weight, tuning) uniformly in all input fields: call input, exchange input and keyer window. This allows also removing code duplication.
"Keyboard" mode had to defined as an additional extension to CQ/S&P (as opposed to an standalone state), as some keys behave differently if one was in CQ or S&P mode.
tune() was moved to keyer() as the common handling is located there.
There is one issue: the SEND_DE
(=F1 sends "DE SEND_DE
handling as a bug fix.
Wouldn't it be more intuitive to have <enter>
close the keying window?
Which key do you mean?
Sorry, markdown/html ate it... <enter>
Would be fine for CW, but it does have a meaning for digimodes. I assume nobody uses back tick even in digimode. And it's just "almost" Esc on the keyboard.
Ok, understood - perhaps it could be both enter
and backtick
in CW and just backtick
in digi?
"Type message and hit enter to send" would be quite natural I'd think
Checked the code: enter is mapped to space (newline is send by | (pipe)). We could change this mapping to happen for digimode only.
Just some comments:
1. provide a single-key alternative to close keyer window without stopping keying. This allows faster typing of additional messages. No need to press Ctrl-K for a graceful exit. The new closing key is ` (grave accent or back tick) that is located below Esc on the US keyboard.
Position of special keys like are not consistent between keyboards for different languages, so the decision may be counterproductive. E.g. on normal german keyboard
needs to use shift key in addition, while ESC is a key of its own. Laptop keyboards are also a different story.
In contrast the suggested '
If not applicable how about something like 'KEY_DOWN' arrow - like 'bring the keyer window down'?
There is one issue: the
SEND_DE
(=F1 sends "DE " in S&P mode) seems to affect call input field only. In exchange input field the plain "" is sent. Not sure if this was deliberate or was simply forgotten.
Was kept from Rein's old TLf versions (just had a look into 0.9.10).
With the common handling it's technically much easier to send in both cases "DE ". If the user still wants to send their bare callsign it is always possible using F6.
Could work. F1 mostly used to just call the other station in S&P, so F6 means you have to change your standard routine (I know it can be done by simply pressing Enter-key, but I remember discussions with hams using only the F-keys).
My suggestion is take this change of
SEND_DE
handling as a bug fix.
Which one? a) having SEND_DE respected in both fields or b) hardcoding F1 to use F1 and F6 to not use it?
If b) we could drop the SEND_DE keyword completely.
Code looks good.
Only question: What do we gain by using separate 'keyboard_mode'?
Added closing on enter in CW mode. Not sure why was the enter->space mapping introduced, as enter makes completely sense in digimode.
Using enter to close keyer windows it pretty logical. One just shall not "overdo" hitting enter as once back to call/exhg input can could inadvertently execute some unwanted action (logging a not yet complete QSO, etc). A separate key is better in this regard, but we can have both.
Re SEND_DE: my preference in a), so F1 would send "DE
Re keyboard_mode: originally keyboard mode (=using keyer window) was a standalone mode with it's own key handling. The mode was temporarily overwritten when in keyer and then restored. This caused a minor discrepancy as F1 behaved differently from the normal input mode (CQ vs. S&P). The solution is to define keyboard mode as "sub-mode" of the input mode. This allows keyer window to evaluate the original input mode and thus F1 behaves the same way as in other input fields.
Not sure why was the enter->space mapping introduced, as enter makes completely sense in digimode.
Without that mapping the display of the keyer windows gets garbled (cursor switches to next line to border of the window). We can drop the mapping for the TX but should keep it for display (or use some more obvious character to show the line break).
Re SEND_DE: my preference in a), so F1 would send "DE " in both input fields. But b) would be also fine: stations calling with DE are very rare.
Ok, I would say lets stay with a). That way input and exchange field have the same behaviour and prepending DE stays optional.
Wrt keyboard_mode: Thanks for explanations. Makes sense.
Added closing on cursor down. Now we have a lot of options... ;-)
I see the point regarding mapping enter key. For the time being I'd leave it as is. It needs a more thorough testing with Fldigi.
Will update the docs as soon as code is stable.