Skip to content

Commit 793ae5e

Browse files
authored
Merge pull request #626 from rumpl/command-palette-position
The command palette should not move
2 parents 8661994 + d0fd5f8 commit 793ae5e

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

pkg/tui/dialog/command_palette.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,8 @@ func (d *commandPaletteDialog) Position() (row, col int) {
283283

284284
maxHeight := min(d.height*70/100, 30)
285285

286-
// Estimate dialog height
287-
dialogHeight := min(8+len(d.filtered), maxHeight)
288-
289286
// Center the dialog
290-
row = max(0, (d.height-dialogHeight)/2)
287+
row = max(0, (d.height-maxHeight)/2)
291288
col = max(0, (d.width-dialogWidth)/2)
292289
return row, col
293290
}
@@ -298,10 +295,3 @@ func (d *commandPaletteDialog) SetSize(width, height int) tea.Cmd {
298295
d.height = height
299296
return nil
300297
}
301-
302-
// OpenCommandPalette returns a command to open the command palette
303-
func OpenCommandPalette(categories []CommandCategory) tea.Cmd {
304-
return core.CmdHandler(OpenDialogMsg{
305-
Model: NewCommandPaletteDialog(categories),
306-
})
307-
}

pkg/tui/tui.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
227227
case key.Matches(msg, a.keyMap.CommandPalette):
228228
// Open command palette
229229
categories := a.buildCommandCategories()
230-
return dialog.OpenCommandPalette(categories)
230+
return core.CmdHandler(dialog.OpenDialogMsg{
231+
Model: dialog.NewCommandPaletteDialog(categories),
232+
})
231233
default:
232234
updated, cmd := a.chatPage.Update(msg)
233235
a.chatPage = updated.(chatpage.Page)

0 commit comments

Comments
 (0)