forked from joejulian/gio
widget: create standalone textView
This commit adds a standalone state type for manipulating and displaying text. It reads text from a minimal interface, shapes it, tracks valid cursor positions, and provides sizing and scrolling services to higher-level widgets. My long term goal with these types is to export them to allow non-core widgets to build atop them, but I've left them private for now. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
+2
-2
@@ -68,7 +68,7 @@ type Editor struct {
|
||||
maxWidth, minWidth int
|
||||
viewSize image.Point
|
||||
valid bool
|
||||
regions []region
|
||||
regions []Region
|
||||
dims layout.Dimensions
|
||||
requestFocus bool
|
||||
|
||||
@@ -750,7 +750,7 @@ func (e *Editor) PaintSelection(gtx layout.Context) {
|
||||
defer clip.Rect(localViewport).Push(gtx.Ops).Pop()
|
||||
e.regions = e.index.locate(docViewport, e.caret.start, e.caret.end, e.regions)
|
||||
for _, region := range e.regions {
|
||||
area := clip.Rect(region.bounds.Sub(e.scrollOff)).Push(gtx.Ops)
|
||||
area := clip.Rect(region.Bounds).Push(gtx.Ops)
|
||||
paint.PaintOp{}.Add(gtx.Ops)
|
||||
area.Pop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user