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

Review hint mode style #3318

Merged
merged 9 commits into from
Jan 22, 2024
Merged

Review hint mode style #3318

merged 9 commits into from
Jan 22, 2024

Conversation

aadcg
Copy link
Member

@aadcg aadcg commented Jan 19, 2024

Description

A follow-up to #3302.

Fixes #3179.
Fixes #3229.

@MaxGyver83 Feel free to review as well. See the sample config snippet below to play with the accepted values.

(define-configuration nyxt/mode/hint:hint-mode
  ((nyxt/mode/hint:hints-alphabet "KDJFLSAIEUROWPQCMVXZ")
   ;; (nyxt/mode/hint:hinting-type :vi)
   (nyxt/mode/hint:x-placement :right)
   (nyxt/mode/hint:x-translation 0)
   ;; (nyxt/mode/hint:y-translation -50)
   ))

Checklist:

  • Git branch state is mergable.
  • Changelog is up to date (via a separate commit).
  • New dependencies are accounted for.
  • Documentation is up to date.
  • Compilation and tests ((asdf:test-system :nyxt/gi-gtk))
    • No new compilation warnings.
    • Tests are sufficient.

@aadcg aadcg requested a review from jmercouris January 19, 2024 14:57
@aadcg aadcg mentioned this pull request Jan 19, 2024
5 tasks
@aadcg aadcg added the 4-series Related to releases whose major version is 4. label Jan 19, 2024
@aadcg aadcg force-pushed the review-hint-mode-style branch from 33b2d1e to bd86385 Compare January 19, 2024 15:17
@MaxGyver83
Copy link
Contributor

MaxGyver83 commented Jan 20, 2024

I have tested this branch/PR. I'm not sure if I have configured it wrong. But no matter if I use (nyxt/mode/hint:x-placement :right) or :left, the hints always cover the text:
image
In my original PR (#3226), the hints were always next to the text.

@aadcg
Copy link
Member Author

aadcg commented Jan 20, 2024

I'm not sure if I have configured it wrong.

Yes, you're missing x-translation (take a look at its docstring). I've just edited a commit that makes the docstring slightly more informative. Give it a try:

(define-configuration nyxt/mode/hint:hint-mode
  ((nyxt/mode/hint:hints-alphabet "KDJFLSAIEUROWPQCMVXZ")
   (nyxt/mode/hint:hinting-type :vi)
   (nyxt/mode/hint:x-placement :right)
   (nyxt/mode/hint:x-translation 100)))
(define-configuration nyxt/mode/hint:hint-mode
  ((nyxt/mode/hint:hints-alphabet "KDJFLSAIEUROWPQCMVXZ")
   (nyxt/mode/hint:hinting-type :vi)
   (nyxt/mode/hint:x-placement :left)
   (nyxt/mode/hint:x-translation -100)))

@aadcg aadcg force-pushed the review-hint-mode-style branch from bd86385 to ead620e Compare January 20, 2024 19:44
@MaxGyver83
Copy link
Contributor

I'm not sure if I have configured it wrong.

Yes, you're missing x-translation (take a look at its docstring). I've just edited a commit that makes the docstring slightly more informative. Give it a try:

(define-configuration nyxt/mode/hint:hint-mode
  ((nyxt/mode/hint:hints-alphabet "KDJFLSAIEUROWPQCMVXZ")
   (nyxt/mode/hint:hinting-type :vi)
   (nyxt/mode/hint:x-placement :right)
   (nyxt/mode/hint:x-translation 100)))
(define-configuration nyxt/mode/hint:hint-mode
  ((nyxt/mode/hint:hints-alphabet "KDJFLSAIEUROWPQCMVXZ")
   (nyxt/mode/hint:hinting-type :vi)
   (nyxt/mode/hint:x-placement :left)
   (nyxt/mode/hint:x-translation -100)))

Sorry for not reading everything before trying. Indeed, this way it works!

This way, I always have to change two values when I want to switch between hints on the left and on the right side ;-). I can live with this.

@MaxGyver83
Copy link
Contributor

I noticed that you also removed the correction for hints that are not visible.
In my original PR, the "C" hint was shifted in such a case:
image

In this PR, the "C" is not visible.
image
(Sorry for the bad screenshot. The scroll bar covers the "C" link partially.)

Is this something you want to add again in a different PR?

@aadcg
Copy link
Member Author

aadcg commented Jan 20, 2024

This way, I always have to change two values when I want to switch between hints on the left and on the right side ;-). I can live with this.

Well, :right and :left both mean drawing on top of the hinted element, which seems like a reasonable default and it is the model we have followed thus far (as explained above). You mean that your preferred customization involved setting 2 parameters: setting a non-default side and a non-default x-translation :)

@aadcg
Copy link
Member Author

aadcg commented Jan 20, 2024

Is this something you want to add again in a different PR?

Indeed. It's a general issue that already existed so it's not directly related to the addition of these options. See #3250.

Although solving it is rather trivial, I've thought about it and I'm not even sure we should do it. Perhaps it should be an option as well. Well, we can discuss it in that issue.

@MaxGyver83
Copy link
Contributor

Well, :right and :left both mean drawing on top of the hinted element, which seems like a reasonable default and it is the model we have followed thus far (as explained above).

It's nice that this covers also the current behavior with just two options for x-placement. 👍

@aadcg aadcg force-pushed the review-hint-mode-style branch from ead620e to 521af5a Compare January 22, 2024 20:22
@aadcg aadcg merged commit 238dddb into master Jan 22, 2024
2 checks passed
@aadcg aadcg deleted the review-hint-mode-style branch January 22, 2024 20:25
@aadcg
Copy link
Member Author

aadcg commented Jan 22, 2024

Thanks @MaxGyver83!

Note that this change won't make into the 3 series releases. To use the feature, please compile from master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4-series Related to releases whose major version is 4.
2 participants