-
Notifications
You must be signed in to change notification settings - Fork 696
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 #3169. Bounds
-> Viewport
: Content Scrolling in View
#3323
Conversation
Why |
I think both are perfectly valid. ViewPort and ContentArea are both terms used in various UI frameworks. For what it's worth, however, WPF uses the term Bounds for this property on controls. |
I also think the |
I meant to mark this PR as draft. I'm experimenting. I have said for a long time that
I have also argued View needs 3 pieces of data to enable built-in scrolling:
One idea is to combine 1) and 3) into a single Another idea is to have separate properties for 1) and 3) (a The size of the content needs to be a In this PR, I decided to run an experiment of what it would be like to keep 1) and 3) a single I researched other UI frameworks and saw the term I wanted to like So, this PR is an experiment. Nothing's decided and renaming Next step for me here is to add Note, there IS another part of all this that needs to be figured out: What do we do about Clearly, clipping only applies to I have continued to ignore this because the one disadvantage of |
…o v2_3269_Bounds-ContentArea
…o v2_3269_Bounds-ContentArea
System.Windows.Forms use it, see https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.control.bounds?view=windowsdesktop-8.0. It's really a
That is what the
If you are meaning the visible area of the content ia always
On my PR I use the
My PR use
The name is irrelevant and must be you to decide because you are the mentor of this project.
Any area is something with a size, no matter is rectangle, square, etc..., but with a location too. But decide by your head and whatever you decide is fine to me, only hopping you understood all my explanations so far.
Leverage what I did so far because it will no diverge so much.
Well that's a real challenger, may be passing an array of rectangles?
That's also my opinion.
Sometimes the use of the |
No, Window Forms does NOT use Bounds for the same thing. In Windows Forms
This is partially why I have long not liked the name.
FWIW, I started this PR because you told me you wanted me to, here: I'm approaching this with as fresh a perspective as I can, asking myself the most fundamental questions and trying to ignore legacy thinking. I find that when I do that, it helps my brain get clarity.
I'm in the middle of thinking this through right now (by actually changing the code and API docs to see the impact). If you look at the current code in this branch you'll see this API doc paragraph:
Terminal.Gui/Terminal.Gui/View/ViewDrawing.cs Lines 372 to 402 in 1549d0d
I don't understand this point. What information would be missing in how I've defined things above that would prevent alignment from working?
Good. That's my current thinking too.
I think we're aligned here. The only difference is the "offset from the top-left (0,0) coordinate of the content to where the visiible area is" in my mind is
I'm trying to do that!
I just looked at #2606 again and am now confused. I SWEAR I implemented a really cool structure there that represnted an irregular region composed of rectangles called Anyway, such a complex API may not be needed... a rectangle is probably fine. But if we're serious about great performance over constrained connections like SSH, it may be worth it.
Yep. Another reason we need to revisit the Color API (see #457). |
Oops. Just noticed a typo:
This should read "...is |
Understood.
Choose one that you like it.
I confirm, but I also expect that you target more or less the same result as I achieve. Remember that I implemented the scroll bars on various views that are working great and I hope you don't break any of them. Otherwise this doesn't make sense. I expect you do it better than I did but with more features and improvements and not the other way.
I doubt that will work well with positive offset. I think that is the contrary of the scrolling behavior. With positive offsets it look like you're pushing to the right and the bottom. But surely you know what you are doing.
Here I only was to note that for drawing we send the real content area, the one that use offset, for redraw contents to the view and not the visible area that is used to clip a region. I didn't mention that there is some problem with alignments at all.
Great.
This is make me confusing. If we are at (0,0) then we are at the start of the content, right?
I know and you'll do it well.
That is very interesting and I'm curious to see how they work with irregular areas.
For sure. It may be more configurable to use a view preference than force only the Normal and Focus, beside I understand the reason for that. |
I understand because it start from 0. This is an example about why it should be negative. You are using as positive but in the reality it should be -5 because the first visible row will be the 0th. See how it work: -5, -4, -3, -2, -1, 0. The 0th will be in the reality the 6th row but ofseted. |
I think it will, but I want to make sure I understand your point. This mental model makes sense to me:
Let's compare this to
I struggle to articulate this so simply if |
Yes, you did:
I am trying to understand what you meant by "Otherwise, it won't redraw as expected considering the |
Correct.
No. It's defined by the view bounds size incremented by the negative location of the
If you meaning
Same answer as above.
Same answer as above.
Same answer as above. If it is only the visible area used by the clipping area the location is always (0,0), otherwise is the negative values of the
You can't compare with
I didn't answer all of them because I'm not change the behavior how they offset left and top, like TextView, TableView, TreeView, etc... and I advise you not to change it. If you use the same code as they use you will struggle with the re-draw and with my solution I don't have to worry about that. The I'm only using in views that the user set the
I think you haven't seen my PR properly yet. Otherwise you will understand how it works. |
I almost dare to say that the cause of the flickering is not related to the |
The cause of the shimmering blue color is due to the |
The other situations are caused by the |
I had reproduced the flicker-bar-thing in cases where there are no Views with (+) Thickness. Not saying you're wrong, just that it's unlikely the only cause. |
Hewre
Here's Scrolling with no Adornments. Note I set a breakpoint in both |
I also set |
Thought maybe it was /// <summary>Fills the specified rectangle with the specified rune, using <see cref="CurrentAttribute"/></summary>
/// <param name="rect">The Screen-relative rectangle.</param>
/// <param name="rune">The Rune used to fill the rectangle</param>
public void FillRect (Rectangle rect, Rune rune = default)
{
rect = Rectangle.Intersect (rect, Clip);
lock (Contents)
{
for (int r = rect.Y; r < rect.Y + rect.Height; r++)
{
for (int c = rect.X; c < rect.X + rect.Width; c++)
{
Contents [r, c] = new Cell
{
Rune = (Rune)' ', Attribute = CurrentAttribute, IsDirty = true
};
_dirtyLines [r] = true;
}
}
}
} |
FWIW, it happens on |
I had already said above that in |
Why does the WindowsTerminal_zAWQtgAdmR.mp4 |
Because That Window shouldn't be movable anyway. |
Even if it was movable, this shouldn't happen. But if it is the Border's |
The horizontal ruler doesn't show anymore on the Scrolling scenario. |
The SetNeedsDisplay is causing the entire View to be Cleared and redrawn. Regardless, it's not CheckBox that's causing the flicker. You are seeing the weird flickering thing. For you it just happens to be over Checkbox. for me it's over Centered. |
Sorry about that. I was debugging and hid some stuff. Fixed. |
I'm done trying to debug this flicker thing for now. So frustrating! |
You're right about that. By coincidence, for me, it appears on the line where the |
Let's move this discussion here: |
Now that this has been merged I encourage everyone to read the updated conceptual docs to ensure an understanding of the new model (and to provide feedback on the docs):
Also the API doc for
If you find issues please either just fix them in a PR or open a new Issue. |
This is a big, far-reaching PR that addresses some fundamental issues in v1 that I originally laid out here:
The Conceptual Documentation for Layout and Drawing has been improved to reflect the new design. Start there.
Things I'm proud of:
Adornment
is coming to fruition. It took a bunch of work but Adornments can now have subviews and it all works (and has unit tests to back it up). Note that in the new "Virtual Content" Scenario the settings UI for Viewports is actually a set of subviews w/inPadding
.ListView
usingViewport.Y
instead of the oldListView._top
. It took another 20 min to remove un-needed code (e.g.ListView.ScrollUp/Down/Left/Right
were replaced withListView.ScrollHoriztonal/ScrollVertical
.ScrollView
depended on unit tests that compared Draw output. Now the core functionality is tested with real unit tests.Things I'm not proud of:
ScrollView
code to work well with subviews of Adornments etc...Fixes
OnMouseXXX
follow the correct pattern #3284 / RefactorMouseEvent
andMouseEventEventArgs
to simplify #3029 (MouseEvent is done, MouseClick remains)Margin
,Border
, andPadding
#2563ScrollBar
based on a newScroll
and removeScrollBarView/ScrollView
#2489EnsureVisibleBounds
is complex & confusing #2407View.Bounds
toView.Viewport
and addView.ContentSize
to enable built-in content scrolling #3169WindowsDriver
in TrueColor mode: Cursor flickers in bottom right corner #3364Viewport
#3302https://github.com/gui-cs/Terminal.Gui/pull/3323/commitsSetRelativeLayout
.Proposed Changes/Todos
Bounds
names. E.g.Viewport
View.Move
)Viewport.Location
can be non-zero).Charmap
to use built-in capabilty; add a temporary 'fake' scrollbar impl based on the updatedButton
that supports continuous button presses.KeepContentInViewport
->ViewportSettings.AllowXGreaterThanContentWidth
ListView
to useViewport.Location
andContentSize
instead of_top
and_left
Changes that can be done after this is merged to finish the new system
ScrollBarView
with a new view,ScrollBar
that is a composotion of 2Button
objects and another new view calledScroll
AutoShowScrollbars