Compare commits

..

3 Commits

Author SHA1 Message Date
sammyette 70c2b91fca
Merge eded38c7b5 into 38d036d96f 2024-06-14 12:57:49 +00:00
sammyette 38d036d96f
fix: history navigation going out of bounds 2024-06-14 08:23:20 -04:00
sammyette 4c61c551aa
fix: menu refreshes
now there's no flicker *and* its not bugged with
leaving the text on exit
2024-05-13 22:10:28 -04:00
3 changed files with 7 additions and 3 deletions

View File

@ -128,15 +128,19 @@ func (rl *Instance) walkHistory(i int) {
} }
rl.histOffset += i rl.histOffset += i
historyLen := history.Len()
if rl.histOffset == 0 { if rl.histOffset == 0 {
rl.line = []rune(rl.lineBuf) rl.line = []rune(rl.lineBuf)
rl.pos = len(rl.lineBuf) rl.pos = len(rl.lineBuf)
} else if rl.histOffset <= -1 { } else if rl.histOffset <= -1 {
rl.histOffset = 0 rl.histOffset = 0
} else if rl.histOffset > historyLen {
// TODO: should this wrap around?s
rl.histOffset = 0
} else { } else {
dedup = true dedup = true
old = string(rl.line) old = string(rl.line)
new, err = history.GetLine(history.Len() - rl.histOffset) new, err = history.GetLine(historyLen - rl.histOffset)
if err != nil { if err != nil {
rl.resetHelpers() rl.resetHelpers()
print("\r\n" + err.Error() + "\r\n") print("\r\n" + err.Error() + "\r\n")

View File

@ -29,7 +29,7 @@ func (rl *Instance) updateTabFind(r []rune) {
rl.search = string(rl.tfLine) rl.search = string(rl.tfLine)
// We update and print // We update and print
rl.clearHelpers() //rl.clearHelpers()
rl.getTabCompletion() rl.getTabCompletion()
rl.renderHelpers() rl.renderHelpers()
} }

View File

@ -121,7 +121,7 @@ func (rl *Instance) clearHelpers() {
moveCursorForwards(rl.fullX) moveCursorForwards(rl.fullX)
// Clear everything below // Clear everything below
//print(seqClearScreenBelow) print(seqClearScreenBelow)
// Go back to current cursor position // Go back to current cursor position
moveCursorBackwards(GetTermWidth()) moveCursorBackwards(GetTermWidth())