feat(tui): status debounce, scroll indicator, drawer label, card grouping
Status messages now use a sequence counter so rapid actions don't cause premature clearing. Detail pane shows scroll position and supports pgup/pgdown/g/G. Capture drawer border includes inline label. Cards view groups by intent (pinned/grab/read/fill) with gutter labels matching the stream view's date grouping pattern.
This commit is contained in:
+29
-2
@@ -62,6 +62,17 @@ func (d detailModel) update(msg tea.KeyMsg) (detailModel, tea.Cmd) {
|
||||
}
|
||||
case "down", "j":
|
||||
d.scroll++
|
||||
case "pgdown", "ctrl+d":
|
||||
d.scroll += d.height
|
||||
case "pgup", "ctrl+u":
|
||||
d.scroll -= d.height
|
||||
if d.scroll < 0 {
|
||||
d.scroll = 0
|
||||
}
|
||||
case "home", "g":
|
||||
d.scroll = 0
|
||||
case "end", "G":
|
||||
d.scroll = 1<<31 - 1
|
||||
}
|
||||
return d, nil
|
||||
}
|
||||
@@ -156,8 +167,24 @@ func (d detailModel) previewView(width int) string {
|
||||
b.WriteString(idStyle.Render(meta))
|
||||
|
||||
lines := strings.Split(b.String(), "\n")
|
||||
if d.scroll > 0 && d.scroll < len(lines) {
|
||||
lines = lines[d.scroll:]
|
||||
totalLines := len(lines)
|
||||
|
||||
maxScroll := totalLines - d.height
|
||||
if maxScroll < 0 {
|
||||
maxScroll = 0
|
||||
}
|
||||
scroll := d.scroll
|
||||
if scroll > maxScroll {
|
||||
scroll = maxScroll
|
||||
}
|
||||
|
||||
if totalLines > d.height && d.height > 0 && len(lines) > 0 {
|
||||
indicator := idStyle.Render(fmt.Sprintf(" %d/%d", scroll+1, totalLines))
|
||||
lines[0] = lines[0] + indicator
|
||||
}
|
||||
|
||||
if scroll > 0 && scroll < totalLines {
|
||||
lines = lines[scroll:]
|
||||
}
|
||||
if d.height > 0 && len(lines) > d.height {
|
||||
lines = lines[:d.height]
|
||||
|
||||
Reference in New Issue
Block a user