1
1
mirror of https://github.com/walles/moar.git synced 2024-11-30 12:42:26 +03:00

Fix the crash

We don't need to render anything and get this precisely right, it just
has to be at least enough.
This commit is contained in:
Johan Walles 2022-10-13 19:43:18 +02:00
parent fa1f38c687
commit 8682d2509b

View File

@ -271,10 +271,12 @@ func (p *Pager) scrollToEnd() {
lastInputLineNumberOneBased := inputLineCount
lastInputLine := p.reader.GetLine(lastInputLineNumberOneBased)
screenLines := p.renderLine(lastInputLine, lastInputLineNumberOneBased)
p.scrollPosition.internalDontTouch.lineNumberOneBased = lastInputLineNumberOneBased
p.scrollPosition.internalDontTouch.deltaScreenLines = len(screenLines) - 1
// Scroll down enough. We know for sure the last line won't wrap into more
// lines than the number of characters it contains.
p.scrollPosition.internalDontTouch.deltaScreenLines = len(lastInputLine.raw)
}
// Can be either because Pager.scrollToEnd() was just called or because the user