Introduce Width::set_ambiguous_wide#806
Conversation
|
How would callers decide to set this value, anyway? Are there ways to query the font metrics, or does the caller basically just have to guess what environment it's running in? |
It depends on the callers.
Either way, the bad news is that there's no very easy way to do it. If there's a concrete way, That's where a global setting might win. We could check an env var to initialize the default, then users (not callers) can change the settings without modifying their programs. A few new thoughts from the discussion:
|
89ab0be to
7fb5cc9
Compare
...it may not be a good idea, because Anyway, I updated the patch, with 2 commits:
|
Okay, I think I now agree that this should be a process-global (maybe a |
Thanks for reviewing. I just rebased before I saw your reply. I'll revert to the global version. |
|
Reverted to the global version, and renamed to |
87e0f68 to
35b7e38
Compare
Consolidate functions to measure widths into a new struct `Width`. This patch has no behavior changes, except a fix where `WideElement::expand` calls the `unicode-width` version if the feature is on, instead of always calling `measure_width`.
Provides a solution for console-rs#497 by allowing callers to opt-in when they're in ambiguous-wide environment. It doesn't cover grapheme cluster issues also discussed in console-rs#497.
|
You changed a bunch of stuff back from my push (merged the test file, method order/names). Any particular reason? |
Not intentional, I think I merged your changes to my checkout manually to fix the test failures (not knowing how to download yours from github), but it sounds like I missed some, sorry about that. Please go ahead with your own. |
Sorry, can you try that again? You should be able to download my commits from GitHub with |
Provides a solution for #497 by allowing callers to opt-in when they're in ambiguous-wide environment.
It doesn't cover grapheme cluster issues also discussed in #497.