Skip to content

Commit b76de53

Browse files
committed
Fix a problem with the cursor position on the external cmdline
1 parent 573c6a5 commit b76de53

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

editor/cmdline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func (c *Cmdline) show(args []interface{}) {
121121
c.content.prompt = prompt
122122
text := c.getText("")
123123
palette.setPattern(text)
124+
c.shown = true
124125
c.cursorMove()
125126
if isResize {
126127
palette.resize()
@@ -130,7 +131,6 @@ func (c *Cmdline) show(args []interface{}) {
130131
palette.scrollCol.Hide()
131132
}
132133
palette.show()
133-
c.shown = true
134134
}
135135

136136
func (c *Cmdline) showAddition() {

editor/cursor.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,11 @@ func (c *Cursor) update() {
621621
c.updateCursorShape()
622622

623623
// if ext_cmdline is true
624-
if c.ws.palette != nil {
625-
if c.ws.palette.widget.IsVisible() {
624+
if c.ws.cmdline != nil {
625+
if c.ws.cmdline.shown {
626626
c.redraw()
627+
// See changepos() in cmdline.go
628+
627629
return
628630
}
629631
}

editor/palette.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,7 @@ func (p *Palette) cursorMove(x int) {
300300
c := p.ws.cursor
301301
if !c.isInPalette {
302302
c.SetParent(p.pattern)
303-
c.x = c.x - float64(p.widget.Pos().X())
304-
c.y = c.y - float64(p.widget.Pos().Y())
303+
p.ws.cursor.isInPalette = true
305304
}
306305
if !(c.x == px && c.y == py) {
307306
c.xprime = c.x
@@ -312,7 +311,6 @@ func (p *Palette) cursorMove(x int) {
312311
c.animateMove()
313312
}
314313

315-
p.ws.cursor.isInPalette = true
316314
p.ws.cursor.update()
317315

318316
p.redrawAllContentInWindows()

0 commit comments

Comments
 (0)