-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add placeholder blinks setting #177
Add placeholder blinks setting #177
Conversation
Sync with verybadcat/master
Codecov Report
@@ Coverage Diff @@
## master #177 +/- ##
==========================================
+ Coverage 87.32% 87.34% +0.01%
==========================================
Files 156 156
Lines 11314 11329 +15
==========================================
+ Hits 9880 9895 +15
Misses 1434 1434
Continue to review full report at Codecov.
|
O, I made a stupid mistake. The caret does not blink anymore if the setting is used. I will copy what charlesroddie proposed. |
…hat the RestingNucleus is shown for all placeholders if the caret blinks
…rue then don't change the CaretState instead of ignoring the changed state later on
I don't understand the enum public enum MathKeyboardCaretState : byte {
Hidden,
TemporarilyHidden,
ShownThroughPlaceholder,
Shown
} Is anyone able to document this enum assuming that it makes sense @Happypig375 @SymboLinker @FoggyFinder ? It seems a little strange to me that, if PlaceholderBlinks, then the path is ShownThroughPlaceholder -> TemporarilyHidden -> Shown -> Hidden -> Shown -> Hidden ... . This suggests to me that ShownThroughPlaceholder is not a valid case. But it's only a guess as I don't understand the meanings. |
TemporarilyHidden -> Shown So this may be a bug. |
Shown: Caret is drawn. Invalid for placeholders. Will disappear when blink timer fires. |
Trying to set to Shown when caret is a placeholder will be automatically set to ShownThroughPlaceholder instead. |
Thanks. Is this better than having only the cases Hidden/TemporarilyHidden/Shown and having Shown display as a cursor or active placeholder depending on the position? Wouldn't removing the ShownThroughPlaceholder case remove two possibilities for invalid data combinations (Shown and in a placeholder, ShownThroughPlaceholder and not in a placeholder)? |
Maybe this would be more clear:
and then as charlesroddie suggested
We could also re-add a Shown enum value that means "don't ever disappear, not even if the timer elapses". |
and avoid invoking RedrawRequested when state has not changed
I've pushed a change to this branch c89ac9e which:
|
@SymboLinker your first idea wouldn't be more clear because placeholders won't be TemporarilyShown (except in the case where you had set PlaceholderBlinks to true) and the second idea requires an extra case and enables options (non-blinking cursor) which would be better expressed as a setting. |
Fixed |
Thank you for adjusting the tests. @Happypig375 Looks like @SymboLinker 's VS is also adding a nuget.config file not just mine. I guess it doesn't matter a lot whether we keep it or gitignore it or find out why it's happening? Anyone with an opinion? |
Thinking about defaults with such avidity has given me a thought that I will keep in mind for some time. Thanks for this possibly useful insight. This led me to read the following again:
Yes, nice. Those subtle things are what LaTeX is about. Because you mentioned "what others do" first, I concluded too quickly that the argumention for a request for changing the default was weak. I should not have overlooked the second part. And here I am, ditching the "I decided not to work on...". |
Sometimes a NuGet.Config should be included, for example if CSharpMath would go use NightlyPackages as a dependency. That is not the case (yet), so that seems no reason to be against ignoring it now. |
@charlesroddie If you don't add unit tests testing your desired behaviour, then there is no guarantee that it will continue to function correctly aside from manual testing. And why test it manually instead of automatically? |
I suspect this can be tested by calling the Keyboard's DrawCaret method with a |
…tionHighlighted" and "ShouldDrawCaret" General notes: Having a CaretState that says "MathKeyboardCaretState.Shown" while actually no caret is shown because a placeholder is shown is wrong. Having a CaretState "MathKeyboardCaretState.Hidden" and "MathKeyboardCaretState.TemporarilyHidden" is not needed: you can use StopBlinking() just after setting the CaretState you want to keep until the next key press. These two observations resulted in the boolean properties "InsertionPositionHighlighted" (that makes sense for both the caret AND the placeholder appearance) and "ShouldDrawCaret". Because Drawing the caret is done in CSharpMath.Rendering.FrontEnd, the unit tests of CSharpMath.Editor can only test "ShouldDraw" and unit tests that do that can cover the same as before (when it was tested via a MathKeyboardCaretState enum). Notes about moved unit tests: - CaretIsOverriddenByPlaceholder has been replaced by PlaceholderDoesNotBlinkAndNoCaretVisible. - CaretMovesWithPlaceholder has been replaced by NonBlinkingActivePlaceholderMoves.
The merge conflict cannot be solved by me. If the changes of cfeb157 are OK, then the MathKeyboardCaretState enum should be deleted in the merge. |
They make sense to me |
Thanks @SymboLinker ! |
In issue #175 a feature request was done for stopping the blinking of the placeholder (but still have a blinking carret if it moves to a spot without a placeholder).
The proposed pull request #176 just removes the blinking of the placeholder and does not leave it as an option.
This pull request adds a setting LaTeXSetting.PlaceholderBlinks that keeps the default value true and does not break any existing unit tests.
Tests are added
@charlesroddie Please verify that the effect of changing the "PlaceholderBlinks"-setting results in the behaviour you like.