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

Replace hints.uppercase with hints.labels #7661

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tcftbl
Copy link

@tcftbl tcftbl commented Apr 12, 2023

This PR introduces a new configuration setting hints.labels. This allows user to use different symbols for onscreen hints and keys. The primary motivation of this is to make vim navigation keys 'hjkl' correspond to arrows '←↓↑→' on screen. Closes #7642

This PR introduces the following changes:

  • adding hints.labels setting and the accompanying documentation (including how to replicate hints.uppercase behaviour)
  • deprecating hints.uppercase and providing the migration code in YamlMigrations in qutebrowser/config/configfiles.py

I'm pretty new to this kind of programming and there are some things I'm not very confident about and would like to get some comments on:

  1. I added quite a lot of completions to the settings in qutebrowser/config/configdata.yml including to hints.chars to complement the completion options in hints.labels. Is this an ok addition?
  2. I made a change to YamlMigrations in qutebrowser/config/configfiles.py but I had some issues removing hints.uppercase. When removing this options I had to replace it with something so that the yaml data remains valid (maybe I missed something here), so I replaced it with hints.labels although that doesn't do anything. I didn't complete understand how YamlMigrations works so I might be doing this in a dumb way. Is there a nice way to do this better or is this method sufficient?

Any other feedback is also greatly appreciated! Thank you for your time.

qutebrowser/browser/hints.py Outdated Show resolved Hide resolved
qutebrowser/config/configdata.yml Show resolved Hide resolved
qutebrowser/config/configdata.yml Outdated Show resolved Hide resolved
qutebrowser/config/configfiles.py Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the description is sufficient here. I only understand it because I have read the discussion leading to this feature. Also, I would assume that most users do not use a config.py and setting one up to preserve the previous functionality seems a bit too much IMHO. Couldn't we use some special value that would be interpreted as hints.chars.upper()?

Copy link
Member

Choose a reason for hiding this comment

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

People can always just set it to ASDFGHJKL (assuming hints.chars set to asdfghjkl) - in fact, that's what the config migration does too!

Yeah, it's a bit cumbersome because you need to change things at two places - but at the same time, having a special <upper> value or whatever seems weird to me as well.

As for the description, what would you suggest? Would something like a "For every character in hints.chars, the character of this setting at the same position will be shown as the corresponding hint text." or so suffice?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah maybe the description could be more concrete. I think the line proposed by @The-Compiler is good and descriptive, but I'll throw my hat into the ring: "In hint text, characters of this settings will be shown instead of characters of hints.chars." A little less descriptive, but a bit more concise.

qutebrowser/config/configdata.yml Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

People can always just set it to ASDFGHJKL (assuming hints.chars set to asdfghjkl) - in fact, that's what the config migration does too!

Yeah, it's a bit cumbersome because you need to change things at two places - but at the same time, having a special <upper> value or whatever seems weird to me as well.

As for the description, what would you suggest? Would something like a "For every character in hints.chars, the character of this setting at the same position will be shown as the corresponding hint text." or so suffice?

qutebrowser/config/configfiles.py Show resolved Hide resolved
('abcdefghijklmnopqrstuvwxyz', None),
(None, None),
])
def test_hints_uppercase(self, yaml, autoconfig, chars, uppercase):
Copy link
Author

Choose a reason for hiding this comment

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

I'm not super happy with this test. I dislike the use None values, but I couldn't figure out how to do this in a nicer way. The problem is the interdependence of hints.chars and hints.uppercase. We have to test for the possibility that one or both of them is unset. Is there a better way to represent this than the use of None values?

@The-Compiler
Copy link
Member

Thanks for the updates @tcftbl and sorry for the radio silence! I'll try to prioritize this once I get back around to merging PRs. Right now I'm focused on getting Qt 6 and qutebrowser v3.0.0 out of the door first.

@tcftbl
Copy link
Author

tcftbl commented Jun 27, 2023

No worries! Let's revisit this later.

@The-Compiler The-Compiler moved this from Focus to Inbox in Pull request backlog Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Arrows for hints
3 participants