Skip to content

Commit

Permalink
sectionHeaderNum lines are the header
Browse files Browse the repository at this point in the history
  • Loading branch information
noborus committed Sep 21, 2023
1 parent 12148cc commit 252d510
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions oviewer/draw.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (root *Root) sectionHeader(lN int) int {
if !m.SectionHeader || m.SectionDelimiter == "" {
return lN
}
log.Println(m.SectionHeader)

sectionLN, err := root.Doc.prevSection(lN)
if err != nil {
log.Println(err)
Expand All @@ -126,10 +126,15 @@ func (root *Root) sectionHeader(lN int) int {
if lN > sectionLN {
sx, sn := 0, sectionLN
line, _ := m.getLineC(sn, m.TabWidth)
for y := m.headerLen; sn <= sectionLN; y++ {
sx, sn = root.drawLine(y, sx, sn, line.lc)
nextY := sn
for y := m.headerLen; sn < sectionLN+m.sectionHeaderNum; y++ {
sx, nextY = root.drawLine(y, sx, sn, line.lc)
root.sectionLineHighlight(y, line.str)
m.headerLen += 1
if nextY != sn {
sn = nextY
line, _ = m.getLineC(sn, m.TabWidth)
}
}
}
return lN
Expand Down

0 comments on commit 252d510

Please sign in to comment.