MCPcopy Index your code
hub / github.com/codehamr/codehamr / historyUp

Method historyUp

internal/tui/keys.go:138–151  ·  view source on GitHub ↗

historyUp walks one step toward older entries; caller gates on cursor-on- first-line and popover closed. Empty history is a no-op.

()

Source from the content-addressed store, hash-verified

136// historyUp walks one step toward older entries; caller gates on cursor-on-
137// first-line and popover closed. Empty history is a no-op.
138func (m Model) historyUp() Model {
139 if len(m.promptHistory) == 0 {
140 return m
141 }
142 // Leaving the live line: stash the unsent draft so ↓ can restore it.
143 if m.histIdx == -1 {
144 m.histDraft = m.ta.Entry()
145 }
146 if m.histIdx+1 < len(m.promptHistory) {
147 m.histIdx++
148 }
149 m.ta.Restore(m.promptHistory[len(m.promptHistory)-1-m.histIdx])
150 return m
151}
152
153// historyDown walks one step toward newer entries; -1 is the live draft
154// sentinel and restores an empty textarea.

Callers 1

handleKeyMethod · 0.95

Calls 2

EntryMethod · 0.80
RestoreMethod · 0.80

Tested by

no test coverage detected