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

Fixes #2597. Enables standard glyphs to be set via ConfigurationManager #2595

Merged
merged 17 commits into from
May 7, 2023

Conversation

tig
Copy link
Collaborator

@tig tig commented May 5, 2023

Fixes #2597

As a distraction from working on the new view architecture, and because i've lost hope that we'll ever be able to ask terminals if they support particular glyphs, I decided to refactor how the standard glyphs are set and enable users to change them via config.

See microsoft/terminal#1040 (comment)

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@tig tig changed the title Enables standard glyphs to be set via ConfigurationManager Fixes #2597. Enables standard glyphs to be set via ConfigurationManager May 5, 2023
@tig tig marked this pull request as ready for review May 5, 2023 21:28
@tig tig requested a review from migueldeicaza as a code owner May 5, 2023 21:28
@tig
Copy link
Collaborator Author

tig commented May 5, 2023

@BDisp @tznind etc... please take a look and review.

/// - unicode char (e.g. "☑")
/// - U+hex format (e.g. "U+2611")
/// - \u format (e.g. "\\u2611")
/// A number
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! I like that we are flexible about what we allow.

Checked = is_checked;
HotKeySpecifier = new Rune ('_');
HotKeySpecifier = Glyphs.HotKeySpecifier;
Copy link
Collaborator

@tznind tznind May 5, 2023

Choose a reason for hiding this comment

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

Is HotKeySpecifier really a Glyph?

I thought it was more like an escape character that indicates to Terminal.Gui where to change color when rendering (and to pick up the next character as the shortcuts?).

I think if the end user was to edit this to another symbol quite a lot of stuff might break in Terminal.Gui apps especially if the applications author just assumes that its _ .

Copy link
Collaborator

Choose a reason for hiding this comment

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

If all the _ are replaced with the Glyphs.HotKeySpecifier there aren't any issue. That will imply the users have to change their code to $"{Glyphs.HotKeySpecifier}whatvever". But isn't a big deal with the editors replacement tools.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ill remove it from Glyphs.

I included it as a mental model test and forgot to remove it.

return _historyText.IsDirty (Text);
}
set {
_historyText.Clear (Text);
Copy link
Collaborator

@tznind tznind May 5, 2023

Choose a reason for hiding this comment

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

This change is unrelated to glyphs? Could you give some insight into what it's for?

Not a problem just curious.

Maybe update the xmldoc too to describe the set use case?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well I'm also curious with this. Do you want, if the value is set to false then clear the _historyText? If so, there is the ClearHistoryChanges method for that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixes a bug in config editor where i want isdirty to be cleared after saving. Will use the method BDisp suggested. Didn't see that.

@tznind
Copy link
Collaborator

tznind commented May 5, 2023

Looks good. Just a few minor points.

This is a great feature, awesome work! 🚀

@BDisp
Copy link
Collaborator

BDisp commented May 5, 2023

It's a very great work, congrats.

@tig
Copy link
Collaborator Author

tig commented May 6, 2023

I got carried away and went further.

  • Almost all glyphs used in the project are now covered. Some more still to come
  • Refactored LineCanvas to ensure when the config changes, existing LineCanvas' instances get updated.
  • Much better docs of each glyph
  • Revamped LineDrawing scenario
    • Support LineCanvas tracking attibutes
    • Floating tool window that uses ColorPicker and RadioGroup
    • Added "Add Layer" button vs. color change

@tznind
Copy link
Collaborator

tznind commented May 6, 2023

Maybe a static value that is changed in configs but not reset after the test or something? Or just a copy/paste typo?

[xUnit.net 00:00:24.06]       Expected:  ╒═╕ \n╔╡1╞╗\n║╘═╛║\n╚═══╝
[xUnit.net 00:00:24.06]       Actual:    ╒═╖ \n╔╡1╞╗\n║╘═╜║\n╚═══╝

@tig
Copy link
Collaborator Author

tig commented May 6, 2023

Typo. I blame chatgpt who I used for some of this.

@tig
Copy link
Collaborator Author

tig commented May 6, 2023

It'll be fun to extend the LineDrawing scenario to do more.

Issues

  • it should show what's gonna be drawn as the mouse drags
  • zero length lines are not handled correctly
  • switch layers
  • undo
  • erase

@tznind
Copy link
Collaborator

tznind commented May 6, 2023 via email

@tig
Copy link
Collaborator Author

tig commented May 6, 2023

Ok. This puppy is ready for final review.

@tig tig merged commit dea5f0f into gui-cs:v2_develop May 7, 2023
@tig tig deleted the v2_config_glyphs branch April 3, 2024 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants