mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
widget: don't draw Editor selection when not focused
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -649,6 +649,9 @@ func (e *Editor) layout(gtx layout.Context, content layout.Widget) layout.Dimens
|
|||||||
|
|
||||||
// PaintSelection paints the contrasting background for selected text.
|
// PaintSelection paints the contrasting background for selected text.
|
||||||
func (e *Editor) PaintSelection(gtx layout.Context) {
|
func (e *Editor) PaintSelection(gtx layout.Context) {
|
||||||
|
if !e.focused {
|
||||||
|
return
|
||||||
|
}
|
||||||
cl := textPadding(e.lines)
|
cl := textPadding(e.lines)
|
||||||
cl.Max = cl.Max.Add(e.viewSize)
|
cl.Max = cl.Max.Add(e.viewSize)
|
||||||
defer clip.Rect(cl).Push(gtx.Ops).Pop()
|
defer clip.Rect(cl).Push(gtx.Ops).Pop()
|
||||||
|
|||||||
Reference in New Issue
Block a user