Skip to content

Commit

Permalink
don't add scrollbars (OverflowAuto) on texteditor panels -- they will…
Browse files Browse the repository at this point in the history
… handle. overrides splits styling.
  • Loading branch information
rcoreilly committed Jul 22, 2024
1 parent c38f747 commit 02a66d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func (cv *Code) Init() {
tree.AddChildAt(w, "tabs", func(w *core.Tabs) {
w.SetType(core.FunctionalTabs)
w.Styler(func(s *styles.Style) {
s.Overflow.Set(styles.OverflowHidden)
s.Grow.Set(1, 1)
})
})
Expand Down Expand Up @@ -189,6 +190,8 @@ func (cv *Code) makeTextEditor(p *tree.Plan, i int) {
w.Styler(func(s *styles.Style) {
s.Direction = styles.Column
s.Grow.Set(1, 1)
// critical to not add additional scrollbars: texteditor does it
s.Overflow.Set(styles.OverflowHidden)
})
tree.AddChildAt(w, "textbut-"+txnm, func(w *core.Button) {
w.SetText("texteditor: " + txnm)
Expand Down
5 changes: 5 additions & 0 deletions code/panels.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package code

import (
"cogentcore.org/core/core"
"cogentcore.org/core/styles"
"cogentcore.org/core/styles/states"
"cogentcore.org/core/texteditor"
)
Expand Down Expand Up @@ -125,6 +126,10 @@ func (cv *Code) RecycleTabTextEditor(name string, buf *texteditor.Buffer) *texte
}
txv := texteditor.NewEditor(fr)
txv.SetName(fr.Name)
fr.Styler(func(s *styles.Style) {
// critical to not add additional scrollbars: texteditor does it
s.Overflow.Set(styles.OverflowHidden)
})
if buf != nil {
txv.SetBuffer(buf)
}
Expand Down
4 changes: 2 additions & 2 deletions code/texteditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ func ConfigOutputTextEditor(ed *texteditor.Editor) {
func ConfigEditorTextEditor(ed *texteditor.Editor) {
ed.Styler(func(s *styles.Style) {
s.Grow.Set(1, 1)
s.Min.X.Ch(40)
s.Min.Y.Em(10)
s.Min.X.Ch(20)
s.Min.Y.Em(5)
})
}

Expand Down

0 comments on commit 02a66d7

Please sign in to comment.