Remove pagination from slash command popup
Slash command list now renders every match at once; the (x/y) counter and page-window slicing only made sense when the popup was capped at a page. Subview pickers (login provider, jump turns, etc.) keep their pagination.
- commit
- 757e158e8ef37076b7aae97ed83d18165119ef25
- author
- patriceckhart · · 2026-05-24 12:39 UTC
- parent
- cd4484d
- signature
- unsigned
- refs
- tag: v0.1.93
1 file · +1 -24
M internal/agent/modes/slash_suggest.go +1 -24
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | package modes | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | - | "fmt" | |
| 5 | 4 | "sort" | |
| 6 | 5 | "strings" | |
| 7 | 6 | ||
| @@ -370,24 +369,6 @@ func (s *slashSuggester) Selection(input string) string { | |||
| 370 | 369 | return m[s.cursor].Name | |
| 371 | 370 | } | |
| 372 | 371 | ||
| 373 | - | func (s *slashSuggester) page(total int) (start, end int) { | |
| 374 | - | if total <= slashSuggestPageSize { | |
| 375 | - | return 0, total | |
| 376 | - | } | |
| 377 | - | if s.cursor < 0 { | |
| 378 | - | s.cursor = 0 | |
| 379 | - | } | |
| 380 | - | if s.cursor >= total { | |
| 381 | - | s.cursor = total - 1 | |
| 382 | - | } | |
| 383 | - | start = (s.cursor / slashSuggestPageSize) * slashSuggestPageSize | |
| 384 | - | end = start + slashSuggestPageSize | |
| 385 | - | if end > total { | |
| 386 | - | end = total | |
| 387 | - | } | |
| 388 | - | return start, end | |
| 389 | - | } | |
| 390 | - | ||
| 391 | 372 | // Render returns the popup lines or nil. | |
| 392 | 373 | func (s *slashSuggester) Render(input string, th tui.Theme, width int) []string { | |
| 393 | 374 | m := s.matches(input) | |
| @@ -418,9 +399,8 @@ func (s *slashSuggester) Render(input string, th tui.Theme, width int) []string | |||
| 418 | 399 | nameWidth = n | |
| 419 | 400 | } | |
| 420 | 401 | } | |
| 421 | - | start, end := s.page(len(m)) | |
| 422 | 402 | var lines []string | |
| 423 | - | for i := start; i < end; i++ { | |
| 403 | + | for i := 0; i < len(m); i++ { | |
| 424 | 404 | c := m[i] | |
| 425 | 405 | if c.Header { | |
| 426 | 406 | // Breathing room around group dividers — a blank row | |
| @@ -446,9 +426,6 @@ func (s *slashSuggester) Render(input string, th tui.Theme, width int) []string | |||
| 446 | 426 | lines = append(lines, th.FG256(th.Muted, plain)) | |
| 447 | 427 | } | |
| 448 | 428 | } | |
| 449 | - | if len(m) > slashSuggestPageSize { | |
| 450 | - | lines = append(lines, th.FG256(th.Muted, fmt.Sprintf(" (%d/%d)", s.cursor+1, len(m)))) | |
| 451 | - | } | |
| 452 | 429 | // Blank row before the hint visually detaches it from the | |
| 453 | 430 | // command list and groups it with its trailing blank. | |
| 454 | 431 | lines = append(lines, "") | |
| @@ -1,7 +1,6 @@ | |||||
| 1 | package modes | 1 | package modes | ||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | - | "fmt" | |||
| 5 | "sort" | 4 | "sort" | ||
| 6 | "strings" | 5 | "strings" | ||
| 7 | 6 | ||||
| @@ -370,24 +369,6 @@ func (s *slashSuggester) Selection(input string) string { | |||||
| 370 | return m[s.cursor].Name | 369 | return m[s.cursor].Name | ||
| 371 | } | 370 | } | ||
| 372 | 371 | ||||
| 373 | - | func (s *slashSuggester) page(total int) (start, end int) { | |||
| 374 | - | if total <= slashSuggestPageSize { | |||
| 375 | - | return 0, total | |||
| 376 | - | } | |||
| 377 | - | if s.cursor < 0 { | |||
| 378 | - | s.cursor = 0 | |||
| 379 | - | } | |||
| 380 | - | if s.cursor >= total { | |||
| 381 | - | s.cursor = total - 1 | |||
| 382 | - | } | |||
| 383 | - | start = (s.cursor / slashSuggestPageSize) * slashSuggestPageSize | |||
| 384 | - | end = start + slashSuggestPageSize | |||
| 385 | - | if end > total { | |||
| 386 | - | end = total | |||
| 387 | - | } | |||
| 388 | - | return start, end | |||
| 389 | - | } | |||
| 390 | - | ||||
| 391 | // Render returns the popup lines or nil. | 372 | // Render returns the popup lines or nil. | ||
| 392 | func (s *slashSuggester) Render(input string, th tui.Theme, width int) []string { | 373 | func (s *slashSuggester) Render(input string, th tui.Theme, width int) []string { | ||
| 393 | m := s.matches(input) | 374 | m := s.matches(input) | ||
| @@ -418,9 +399,8 @@ func (s *slashSuggester) Render(input string, th tui.Theme, width int) []string | |||||
| 418 | nameWidth = n | 399 | nameWidth = n | ||
| 419 | } | 400 | } | ||
| 420 | } | 401 | } | ||
| 421 | - | start, end := s.page(len(m)) | |||
| 422 | var lines []string | 402 | var lines []string | ||
| 423 | - | for i := start; i < end; i++ { | 403 | + | for i := 0; i < len(m); i++ { |
| 424 | c := m[i] | 404 | c := m[i] | ||
| 425 | if c.Header { | 405 | if c.Header { | ||
| 426 | // Breathing room around group dividers — a blank row | 406 | // Breathing room around group dividers — a blank row | ||
| @@ -446,9 +426,6 @@ func (s *slashSuggester) Render(input string, th tui.Theme, width int) []string | |||||
| 446 | lines = append(lines, th.FG256(th.Muted, plain)) | 426 | lines = append(lines, th.FG256(th.Muted, plain)) | ||
| 447 | } | 427 | } | ||
| 448 | } | 428 | } | ||
| 449 | - | if len(m) > slashSuggestPageSize { | |||
| 450 | - | lines = append(lines, th.FG256(th.Muted, fmt.Sprintf(" (%d/%d)", s.cursor+1, len(m)))) | |||
| 451 | - | } | |||
| 452 | // Blank row before the hint visually detaches it from the | 429 | // Blank row before the hint visually detaches it from the | ||
| 453 | // command list and groups it with its trailing blank. | 430 | // command list and groups it with its trailing blank. | ||
| 454 | lines = append(lines, "") | 431 | lines = append(lines, "") | ||