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:
Binary file not shown.
@ -35,6 +35,7 @@ func NewHistoryView(cfg *config.Config, log logger.Logger, parent tea.Model) His
|
|||||||
logger: log,
|
logger: log,
|
||||||
parent: parent,
|
parent: parent,
|
||||||
history: loadHistory(cfg),
|
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(infoStyle.Render("📭 No backup history found"))
|
||||||
s.WriteString("\n\n")
|
s.WriteString("\n\n")
|
||||||
} else {
|
} 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 {
|
for i, entry := range m.history {
|
||||||
cursor := " "
|
line := fmt.Sprintf("[%s] %s - %s (%s)",
|
||||||
line := fmt.Sprintf("%s [%s] %s - %s (%s)",
|
|
||||||
cursor,
|
|
||||||
entry.Timestamp.Format("2006-01-02 15:04"),
|
entry.Timestamp.Format("2006-01-02 15:04"),
|
||||||
entry.Type,
|
entry.Type,
|
||||||
entry.Database,
|
entry.Database,
|
||||||
entry.Status)
|
entry.Status)
|
||||||
|
|
||||||
if m.cursor == i {
|
if m.cursor == i {
|
||||||
s.WriteString(selectedStyle.Render("> " + line))
|
// Highlighted selection
|
||||||
|
s.WriteString(selectedStyle.Render("→ " + line))
|
||||||
} else {
|
} else {
|
||||||
s.WriteString(" " + line)
|
s.WriteString(" " + line)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user