Finish addLine split (addLinePageBreak)

This commit is contained in:
2026-07-22 21:51:06 +07:00
parent e1f065e783
commit 389db14bbf

View File

@@ -544,6 +544,25 @@ func (g *RogueGame) addLinePaged(line string, isFlush bool) {
} }
if pg.lineCnt >= NumLines-1 || isFlush { if pg.lineCnt >= NumLines-1 || isFlush {
g.addLinePageBreak(prompt, isFlush)
}
if !isFlush && (pg.lineCnt != 0 || line != "") {
g.scr.Hw.MvAddStr(pg.lineCnt, 0, line)
pg.lineCnt++
if pg.maxlen < len(line) {
pg.maxlen = len(line)
}
pg.lastLine = line
}
}
// addLinePageBreak prompts at a full page and starts a fresh one
// (things.c add_line).
func (g *RogueGame) addLinePageBreak(prompt string, isFlush bool) {
pg := &g.invPage
if g.Options.InvType == InvOver && isFlush && !pg.newpage { if g.Options.InvType == InvOver && isFlush && !pg.newpage {
g.addLineOverlay(prompt) g.addLineOverlay(prompt)
} else { } else {
@@ -557,18 +576,6 @@ func (g *RogueGame) addLinePaged(line string, isFlush bool) {
pg.newpage = true pg.newpage = true
pg.lineCnt = 0 pg.lineCnt = 0
pg.maxlen = len(prompt) pg.maxlen = len(prompt)
}
if !isFlush && (pg.lineCnt != 0 || line != "") {
g.scr.Hw.MvAddStr(pg.lineCnt, 0, line)
pg.lineCnt++
if pg.maxlen < len(line) {
pg.maxlen = len(line)
}
pg.lastLine = line
}
} }
// addLineOverlay draws the accumulated list in a box at the top right // addLineOverlay draws the accumulated list in a box at the top right