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

Allow mod-tap hold action on one shot layer #19214

Merged
merged 4 commits into from
Jan 2, 2023
Merged

Conversation

kosorin
Copy link
Contributor

@kosorin kosorin commented Nov 30, 2022

Description

This proposal allows mod-tap hold action on one shot layer. One shot layer is immediately disabled if MT() is pressed and therefore mod-tap hold is not possible.

Example:

Following example currently produce a lower case character x.

 [L1] = LAYOUT(KC_X, OSL(L2))
 [L2] = LAYOUT(KC_A, LSFT_T(...))
  • on layer 1
  • OSL(L2) down
  • OSL(L2) up
  • on layer 2
  • LSFT_T(...) down
  • KC_A down
  • KC_A up
  • LSFT_T(...) up

With the proposed change the result is a upper case A and it will behave same as KC_LSFT.

I'm not aware if this covers all possible situations, but I've tested it for several months with no problems.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@github-actions github-actions bot added the core label Nov 30, 2022
@drashna drashna requested a review from a team December 15, 2022 19:48
Copy link
Member

@drashna drashna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could you add to the unit tests to ensure that this behavior is properly tested?

quantum/action.c Outdated Show resolved Hide resolved
@drashna drashna requested a review from a team December 15, 2022 20:05
@kosorin
Copy link
Contributor Author

kosorin commented Dec 18, 2022

I added a few unit tests and fixed a small bug that I discovered thanks to the tests. I'm not sure that's enough. It certainly doesn't test all permutations of all Tap-Hold options.

@kosorin kosorin requested a review from drashna December 27, 2022 10:50
@drashna
Copy link
Member

drashna commented Jan 1, 2023

I added a few unit tests and fixed a small bug that I discovered thanks to the tests. I'm not sure that's enough. It certainly doesn't test all permutations of all Tap-Hold options.

Well, having them at all is a huge thing. And they've already proven when even basic tests are definitely better than nothing, here. :)

At the very least, it helps with confidence in the code. And more robust testing can be added later.

Copy link
Member

@KarlK90 KarlK90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing bugs and adding unit-tests in the progress! This is much appreciated. The changes LGTM.

@KarlK90 KarlK90 merged commit 0f55001 into qmk:develop Jan 2, 2023
omikronik pushed a commit to omikronik/qmk_firmware that referenced this pull request Jan 22, 2023
@kosorin kosorin deleted the osl-mt branch February 7, 2023 23:55
@NapOli1084 NapOli1084 mentioned this pull request Apr 11, 2023
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants