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

Improve keyer: unify key handling and add graceful closing of keyer window #431

Merged
merged 15 commits into from
May 24, 2024

Conversation

zcsahok
Copy link
Member

@zcsahok zcsahok commented Apr 30, 2024

(this is still work in progress, comments are welcome)

My motivation was twofold:

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

  2. 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 " 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.
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.
My suggestion is take this change of SEND_DE handling as a bug fix.

@df7cb
Copy link
Contributor

df7cb commented Apr 30, 2024

Wouldn't it be more intuitive to have <enter> close the keying window?

@zcsahok
Copy link
Member Author

zcsahok commented Apr 30, 2024

Which key do you mean?

@df7cb
Copy link
Contributor

df7cb commented Apr 30, 2024

Sorry, markdown/html ate it... <enter>

@zcsahok
Copy link
Member Author

zcsahok commented Apr 30, 2024

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.

@df7cb
Copy link
Contributor

df7cb commented Apr 30, 2024

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

@zcsahok
Copy link
Member Author

zcsahok commented Apr 30, 2024

Checked the code: enter is mapped to space (newline is send by | (pipe)).
We could change this mapping to happen for digimode only.

@dl1jbe
Copy link
Member

dl1jbe commented May 3, 2024

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 '' looks quite standardized.

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.

@dl1jbe
Copy link
Member

dl1jbe commented May 4, 2024

Code looks good.

Only question: What do we gain by using separate 'keyboard_mode'?

@zcsahok
Copy link
Member Author

zcsahok commented May 4, 2024

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.

@zcsahok
Copy link
Member Author

zcsahok commented May 4, 2024

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.

@zcsahok
Copy link
Member Author

zcsahok commented May 4, 2024

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.

@dl1jbe
Copy link
Member

dl1jbe commented May 5, 2024

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.

@zcsahok
Copy link
Member Author

zcsahok commented May 5, 2024

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.

@dl1jbe
Copy link
Member

dl1jbe commented May 24, 2024

1. Should be merged in.

@zcsahok
Copy link
Member Author

zcsahok commented May 24, 2024

Documented Enter too. And trying to avoid line break on the hyphen in Ctrl-K/Alt-K.

@zcsahok zcsahok merged commit 0ac0597 into Tlf:master May 24, 2024
2 checks passed
@zcsahok zcsahok deleted the improve_keyer branch May 24, 2024 21:00
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.

3 participants