aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ui/textinput.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui/textinput.go')
-rw-r--r--lib/ui/textinput.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go
index 65570e8b..d76e9349 100644
--- a/lib/ui/textinput.go
+++ b/lib/ui/textinput.go
@@ -151,7 +151,16 @@ func (ti *TextInput) drawPopover(ctx *Context) {
}
width := maxLen(ti.completions) + 3
height := len(ti.completions)
- ctx.Popover(0, 0, width, height, cmp)
+
+ pos := len(ti.prefix) - ti.scroll
+ if pos+width > ctx.Width() {
+ pos = ctx.Width() - width
+ }
+ if pos < 0 {
+ pos = 0
+ }
+
+ ctx.Popover(pos, 0, width, height, cmp)
}
func (ti *TextInput) MouseEvent(localX int, localY int, event tcell.Event) {