Skip to content

Commit 2845e65

Browse files
committed
When clicking in an editable view, set the cursor
v.SetCursor doesn't do this, we need to call SetCursor2D on the TextArea in addition.
1 parent 0c4bf77 commit 2845e65

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gui.go

+9
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,15 @@ func (g *Gui) onKey(ev *GocuiEvent) error {
13561356
if err := v.SetCursor(newCx, newCy); err != nil {
13571357
return err
13581358
}
1359+
if v.Editable {
1360+
v.TextArea.SetCursor2D(newX, newY)
1361+
1362+
// SetCursor2D might have adjusted the text area's cursor to the
1363+
// left to move left from a soft line break, so we need to
1364+
// update the view's cursor to match the text area's cursor.
1365+
cX, _ := v.TextArea.GetCursorXY()
1366+
v.SetCursorX(cX)
1367+
}
13591368
}
13601369

13611370
if IsMouseKey(ev.Key) {

0 commit comments

Comments
 (0)