@@ -29,6 +29,10 @@ type FilterCompletionsMsg struct {
2929 Reopen bool
3030}
3131
32+type RepositionCompletionsMsg struct {
33+ X, Y int
34+}
35+
3236type CompletionsClosedMsg struct{}
3337
3438type CompletionsOpenedMsg struct{}
@@ -52,6 +56,7 @@ type Completions interface {
5256
5357type completionsCmp struct {
5458 wWidth int // The window width
59+ wHeight int // The window height
5560 width int
5661 lastWidth int
5762 height int // Height of the completions component`
@@ -88,7 +93,7 @@ func New() Completions {
8893 )
8994 return &completionsCmp{
9095 width: 0,
91− height: 0,
96+ height: maxCompletionsHeight,
9297 list: l,
9398 query: "",
9499 keyMap: completionsKeyMap,
@@ -107,8 +112,7 @@ func (c *completionsCmp) Init() tea.Cmd {
107112func (c *completionsCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
108113 switch msg := msg.(type) {
109114 case tea.WindowSizeMsg:
110− c.wWidth = msg.Width
111− c.height = min(msg.Height-c.y, 15)
115+ c.wWidth, c.wHeight = msg.Width, msg.Height
112116 return c, nil
113117 case tea.KeyPressMsg:
114118 switch {
@@ -159,6 +163,8 @@ func (c *completionsCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
159163 case key.Matches(msg, c.keyMap.Cancel):
160164 return c, util.CmdHandler(CloseCompletionsMsg{})
161165 }
166+ case RepositionCompletionsMsg:
167+ c.x, c.y = msg.X, msg.Y
162168 case CloseCompletionsMsg:
163169 c.open = false
164170 return c, util.CmdHandler(CompletionsClosedMsg{})