Skip to content

Conversation

@Storik4pro
Copy link

Top and bottom offset for content

If this control will be used with some flyouts (like search-replace flyout) content offset may be useful

For example modern notepad application изображение изображение

I'm not good c# developer, but for a first look that works without any bugs. Also I worry about performance - my formulas may be not optimized

Make horizontal scrollbar usable

9cca937

Right now user can't normally edit line under scrollbar (If user enable "Always show scrollbars" in settings that line cannot be edited). If line is last editing is not possible.

How it look before изображение

User can't access line 45

How it look after изображение

User can access any line without problems

Now horizontal scrollbar doesn't interfere text editing and selection on last line (Before this change user can misclick on scrollbar instead of text line)
…g VerticalDrawOffset to class functions

VerticalDrawOffset will be applyed to:
- CalculateLinesToRender function
- SearchHighlightsRenderer.RenderHighlights (OffsetTop param)
- CanvasDrawingSession.DrawTextLayout (Y param)
- invisibleCharactersRenderer.DrawTabsAndSpaces (singleLineHeight param)
Also:
- UpdateScrollOffset function will be added for handle control vertical scroll offset changing
- float VerticalDrawOffset variable (default value is 0)
- double TopScrollOffset and BottomScrollOffset variables
…if ContentVerticalScrollOffset property changed
…ing; Make TopScrollOffset and BottomScrollOffset field public for get

Code refactor:
- Move offset calculating logic to local function
Fixed bug:
- When cursor located out of viewport local offset not applied to vertical scroll value
@FrozenAssassine
Copy link
Owner

Looks pretty good. This problem always annoyed me as well, thanks for your fix🙏🏻.
I will look over the code, and merge it later :D

@FrozenAssassine
Copy link
Owner

I refactored small parts of your code, but I spotted some problems. My changes are in a new pull request

About the problems I found:

  1. When zooming in, the top offset gets smaller until it is completely at 0.

  2. When there are no lines in the textbox, and you start adding them by pressing enter, there is a case, where the text does start scrolling, but the top offset is gone until you add more lines.

I will close this Pull request, lets continue from the new one for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants