@@ -27,9 +27,7 @@ type CommandType uint
27func (c CommandType) String() string { return []string{"System", "User", "MCP"}[c] }
27func (c CommandType) String() string { return []string{"System", "User", "MCP"}[c] }
30− sidebarCompactModeBreakpoint = 120
30+ sidebarCompactModeBreakpoint = 120
31− defaultCommandsDialogMaxHeight = 20
32− defaultCommandsDialogMaxWidth = 70
@@ -155,19 +153,17 @@ func (c *Commands) HandleMsg(msg tea.Msg) Action {
155 c.list.Focus()
153 c.list.Focus()
156 if c.list.IsSelectedFirst() {
154 if c.list.IsSelectedFirst() {
157 c.list.SelectLast()
155 c.list.SelectLast()
158− c.list.ScrollToBottom()
156+ } else {
159− break
157+ c.list.SelectPrev()
162 c.list.ScrollToSelected()
159 c.list.ScrollToSelected()
163 case key.Matches(msg, c.keyMap.Next):
160 case key.Matches(msg, c.keyMap.Next):
164 c.list.Focus()
161 c.list.Focus()
165 if c.list.IsSelectedLast() {
162 if c.list.IsSelectedLast() {
166 c.list.SelectFirst()
163 c.list.SelectFirst()
167− c.list.ScrollToTop()
164+ } else {
168− break
165+ c.list.SelectNext()
171 c.list.ScrollToSelected()
167 c.list.ScrollToSelected()
172 case key.Matches(msg, c.keyMap.Select):
168 case key.Matches(msg, c.keyMap.Select):
173 if selectedItem := c.list.SelectedItem(); selectedItem != nil {
169 if selectedItem := c.list.SelectedItem(); selectedItem != nil {
@@ -240,8 +236,8 @@ func commandsRadioView(sty *styles.Styles, selected CommandType, hasUserCmds boo
240// Draw implements [Dialog].
236// Draw implements [Dialog].
241func (c *Commands) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
237func (c *Commands) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
242 t := c.com.Styles
238 t := c.com.Styles
243− width := max(0, min(defaultCommandsDialogMaxWidth, area.Dx()-t.Dialog.View.GetHorizontalBorderSize()))
239+ width := max(0, min(defaultDialogMaxWidth, area.Dx()-t.Dialog.View.GetHorizontalBorderSize()))
244− height := max(0, min(defaultCommandsDialogMaxHeight, area.Dy()-t.Dialog.View.GetVerticalBorderSize()))
240+ height := max(0, min(defaultDialogHeight, area.Dy()-t.Dialog.View.GetVerticalBorderSize()))
245 if area.Dx() != c.windowWidth && c.selected == SystemCommands {
241 if area.Dx() != c.windowWidth && c.selected == SystemCommands {
246 c.windowWidth = area.Dx()
242 c.windowWidth = area.Dx()
247 // since some items in the list depend on width (e.g. toggle sidebar command),
243 // since some items in the list depend on width (e.g. toggle sidebar command),