Fix: Operation history navigation now visible with arrow keys

FIXED:
- Removed unused cursor variable that was always a space
- Arrow up/down now visibly highlights selected item
- Added position counter (Viewing X/Y)
- Changed selection indicator from ">" to "→"
- Explicit cursor initialization to 0

RESULT:
- ↑/↓ keys now work and show visual feedback
- Current selection clearly visible with highlight
- Position indicator shows which item is selected
This commit is contained in:
2025-11-07 11:54:08 +00:00
parent 567400a582
commit d51653a857
3 changed files with 6 additions and 5 deletions

BIN
dbbackup

Binary file not shown.

Binary file not shown.

View File

@ -35,6 +35,7 @@ func NewHistoryView(cfg *config.Config, log logger.Logger, parent tea.Model) His
logger: log,
parent: parent,
history: loadHistory(cfg),
cursor: 0, // Start at first item
}
}
@ -125,19 +126,19 @@ func (m HistoryViewModel) View() string {
s.WriteString(infoStyle.Render("📭 No backup history found"))
s.WriteString("\n\n")
} else {
s.WriteString(fmt.Sprintf("Found %d backup operations:\n\n", len(m.history)))
s.WriteString(fmt.Sprintf("Found %d backup operations (Viewing %d/%d):\n\n",
len(m.history), m.cursor+1, len(m.history)))
for i, entry := range m.history {
cursor := " "
line := fmt.Sprintf("%s [%s] %s - %s (%s)",
cursor,
line := fmt.Sprintf("[%s] %s - %s (%s)",
entry.Timestamp.Format("2006-01-02 15:04"),
entry.Type,
entry.Database,
entry.Status)
if m.cursor == i {
s.WriteString(selectedStyle.Render("> " + line))
// Highlighted selection
s.WriteString(selectedStyle.Render("→ " + line))
} else {
s.WriteString(" " + line)
}