cogentcore / core

A free and open source framework for building powerful, fast, and elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the Web with a single pure Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.31k stars 71 forks source link

texteditor output buff in code is not getting scrollbars on initial render (e.g., for diffs) #900

Closed rcoreilly closed 1 month ago

rcoreilly commented 4 months ago

Describe the bug

see title

How to reproduce

diff in cogent code with lots of diffs

Example code

No response

Relevant output

No response

Platform

macOS

rcoreilly commented 4 months ago

this is regression from latest update to texteditor layout update.

rcoreilly commented 4 months ago

also not scrolling at the end either.

rcoreilly commented 4 months ago

the final update call is happening in:

texteditor/buf.go: func (tb *Buf) AutoScrollViews() {

I added an ed.SetNeedsLayout there, but it is getting swallowed somehow (and for ed.Layout.SetNeedLayout too)

rcoreilly commented 4 months ago

Also getting the situation where initial click on link (e.g., in find, err) does not jump to the correct position until a key event triggers a render update.

rcoreilly commented 4 months ago

also jump to line doesn't work the first time.

rcoreilly commented 4 months ago

This appears to be specific to Code -- not replicable in any of the cases in plain texteditor example.

rcoreilly commented 4 months ago

Jump to line had a bizarre ge.Indent call stuck in it -- removing that seems to fix that issue.

the find link clicks seem to be due to LongPress intruding -- increasing this to 1s fixes this issue.

the original issue here is still present but fixes itself immediately after any render update is triggered, so it is lower pri.

kkoreilly commented 4 months ago

So will you close the issue?

rcoreilly commented 4 months ago

Jump is still not working again actually -- on first time in a new file.

and link click is still pulling up a context menu!

rcoreilly commented 4 months ago

recent fixes have resolved the important aspects of this. will file more specific issues if anything else comes up.

kkoreilly commented 2 months ago

All text editors no longer have scrollbars on initial render, and they also do not get allocated enough space. This regression happened sometime during the big renaming PR.

rcoreilly commented 2 months ago

This is not a regression: the separate texteditor demo still works (and code still works for main editors) with latest. It is something to do with having the editors within the demo tabs structure. this is consistent with the fact that the scrollbar issue only happens in code for tabs. will investigate.

kkoreilly commented 2 months ago

Again, this issue also happens in the documentation and unit tests, and it is not limited to tabs.

rcoreilly commented 2 months ago

I am seeing scrollbars in docs.

re the sizing: I don't think there is really a sensible universal default size for a texteditor -- would it make more sense to just specify that as needed, in the docs?

rcoreilly commented 1 month ago

This is now fully fixed I hope! initial layout was being done before enough size info was avail -- now doing in SizeDown and seems to be working reliably. also fixed the issues with autoscroll in code.