mirror of https://github.com/liamg/aminal.git
Fix memory leaking (#156)
This commit is contained in:
parent
43072eb024
commit
6f11a23e6a
|
@ -587,7 +587,8 @@ func (buffer *Buffer) Index() {
|
||||||
buffer.lines = append(buffer.lines, newLine())
|
buffer.lines = append(buffer.lines, newLine())
|
||||||
maxLines := buffer.getMaxLines()
|
maxLines := buffer.getMaxLines()
|
||||||
if uint64(len(buffer.lines)) > maxLines {
|
if uint64(len(buffer.lines)) > maxLines {
|
||||||
buffer.lines = buffer.lines[ uint64(len(buffer.lines)) - maxLines : ]
|
copy(buffer.lines, buffer.lines[ uint64(len(buffer.lines)) - maxLines:])
|
||||||
|
buffer.lines = buffer.lines[:maxLines]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buffer.cursorY++
|
buffer.cursorY++
|
||||||
|
@ -968,6 +969,7 @@ func (buffer *Buffer) ResizeView(width uint16, height uint16) {
|
||||||
if i+1 < len(buffer.lines) {
|
if i+1 < len(buffer.lines) {
|
||||||
nextLine := &buffer.lines[i+1]
|
nextLine := &buffer.lines[i+1]
|
||||||
if nextLine.wrapped {
|
if nextLine.wrapped {
|
||||||
|
|
||||||
nextLine.cells = append(sillyCells, nextLine.cells...)
|
nextLine.cells = append(sillyCells, nextLine.cells...)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue