From d83a73635000f121e5ccb3516aa2997534b6bc65 Mon Sep 17 00:00:00 2001 From: Noboru Saito Date: Fri, 29 Dec 2023 11:29:59 +0900 Subject: [PATCH] Improved display when moving the first row up --- oviewer/draw.go | 2 +- oviewer/move.go | 1 + oviewer/move_vertical.go | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oviewer/draw.go b/oviewer/draw.go index 7157f188..b2fa0846 100644 --- a/oviewer/draw.go +++ b/oviewer/draw.go @@ -121,7 +121,7 @@ func (root *Root) drawSectionHeader(lN int) int { pn := lN // prevSection searches for the section above the specified line. - if pn == 0 { + if m.startTopFlag && pn <= 0 { pn = 1 } sectionLN, err := m.prevSection(pn) diff --git a/oviewer/move.go b/oviewer/move.go index 4e395646..0daba19b 100644 --- a/oviewer/move.go +++ b/oviewer/move.go @@ -10,6 +10,7 @@ func (root *Root) moveTop() { root.resetSelect() defer root.releaseEventBuffer() + root.Doc.startTopFlag = true root.Doc.moveTop() } diff --git a/oviewer/move_vertical.go b/oviewer/move_vertical.go index c6454ab3..8d5abd39 100644 --- a/oviewer/move_vertical.go +++ b/oviewer/move_vertical.go @@ -25,7 +25,6 @@ func (m *Document) moveLine(lN int) int { // moveTop moves to the top. func (m *Document) moveTop() { - m.startTopFlag = true m.moveLine(m.BufStartNum()) }