forked from Mirrors/bubbletea
Correct scroll area top positioning
This commit is contained in:
parent
8e616c4c0c
commit
da9a1fe2f4
|
@ -204,13 +204,14 @@ func (r *renderer) insertTop(lines []string, topBoundary, bottomBoundary int) {
|
||||||
r.mtx.Lock()
|
r.mtx.Lock()
|
||||||
defer r.mtx.Unlock()
|
defer r.mtx.Unlock()
|
||||||
|
|
||||||
|
topBoundary += 1
|
||||||
b := new(bytes.Buffer)
|
b := new(bytes.Buffer)
|
||||||
|
|
||||||
saveCursorPosition(b)
|
saveCursorPosition(b)
|
||||||
changeScrollingRegion(b, topBoundary, bottomBoundary)
|
changeScrollingRegion(b, topBoundary, bottomBoundary)
|
||||||
moveCursor(b, topBoundary, 0)
|
moveCursor(b, topBoundary, 0)
|
||||||
insertLine(b, len(lines))
|
insertLine(b, len(lines))
|
||||||
_, _ = io.WriteString(b, "\r\n"+strings.Join(lines, "\r\n"))
|
_, _ = io.WriteString(b, strings.Join(lines, "\r\n"))
|
||||||
changeScrollingRegion(b, 0, r.height)
|
changeScrollingRegion(b, 0, r.height)
|
||||||
restoreCursorPosition(b)
|
restoreCursorPosition(b)
|
||||||
|
|
||||||
|
@ -230,6 +231,7 @@ func (r *renderer) insertBottom(lines []string, topBoundary, bottomBoundary int)
|
||||||
r.mtx.Lock()
|
r.mtx.Lock()
|
||||||
defer r.mtx.Unlock()
|
defer r.mtx.Unlock()
|
||||||
|
|
||||||
|
topBoundary += 1
|
||||||
b := new(bytes.Buffer)
|
b := new(bytes.Buffer)
|
||||||
|
|
||||||
saveCursorPosition(b)
|
saveCursorPosition(b)
|
||||||
|
|
Loading…
Reference in New Issue