|
@@ -36,6 +36,7 @@ class BufferLine {
|
|
|
bool isWrapped;
|
|
bool isWrapped;
|
|
|
|
|
|
|
|
int _maxCols = 64;
|
|
int _maxCols = 64;
|
|
|
|
|
+ int? _currentTrimmedLength;
|
|
|
|
|
|
|
|
void ensure(int length) {
|
|
void ensure(int length) {
|
|
|
final expectedLengthInBytes = length * _cellSize;
|
|
final expectedLengthInBytes = length * _cellSize;
|
|
@@ -75,6 +76,7 @@ class BufferLine {
|
|
|
for (var i = moveEnd; i < bufferEnd; i++) {
|
|
for (var i = moveEnd; i < bufferEnd; i++) {
|
|
|
cells[i] = 0x00;
|
|
cells[i] = 0x00;
|
|
|
}
|
|
}
|
|
|
|
|
+ _currentTrimmedLength = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void insertN(int index, int count) {
|
|
void insertN(int index, int count) {
|
|
@@ -104,6 +106,7 @@ class BufferLine {
|
|
|
for (var i = moveStart; i < moveStart + moveOffset; i++) {
|
|
for (var i = moveStart; i < moveStart + moveOffset; i++) {
|
|
|
cells[i] = 0x00;
|
|
cells[i] = 0x00;
|
|
|
}
|
|
}
|
|
|
|
|
+ _currentTrimmedLength = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void clear() {
|
|
void clear() {
|
|
@@ -123,6 +126,7 @@ class BufferLine {
|
|
|
void cellClear(int index) {
|
|
void cellClear(int index) {
|
|
|
_cells.setInt64(index * _cellSize, 0x00);
|
|
_cells.setInt64(index * _cellSize, 0x00);
|
|
|
_cells.setInt64(index * _cellSize + 8, 0x00);
|
|
_cells.setInt64(index * _cellSize + 8, 0x00);
|
|
|
|
|
+ _currentTrimmedLength = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void cellInitialize(
|
|
void cellInitialize(
|
|
@@ -137,6 +141,7 @@ class BufferLine {
|
|
|
_cells.setInt32(cell + _cellBgColor, cursor.bg);
|
|
_cells.setInt32(cell + _cellBgColor, cursor.bg);
|
|
|
_cells.setInt8(cell + _cellWidth, width);
|
|
_cells.setInt8(cell + _cellWidth, width);
|
|
|
_cells.setInt8(cell + _cellFlags, cursor.flags);
|
|
_cells.setInt8(cell + _cellFlags, cursor.flags);
|
|
|
|
|
+ _currentTrimmedLength = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool cellHasContent(int index) {
|
|
bool cellHasContent(int index) {
|
|
@@ -152,6 +157,7 @@ class BufferLine {
|
|
|
|
|
|
|
|
void cellSetContent(int index, int content) {
|
|
void cellSetContent(int index, int content) {
|
|
|
_cells.setInt32(index * _cellSize + _cellContent, content);
|
|
_cells.setInt32(index * _cellSize + _cellContent, content);
|
|
|
|
|
+ _currentTrimmedLength = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int cellGetFgColor(int index) {
|
|
int cellGetFgColor(int index) {
|
|
@@ -196,6 +202,7 @@ class BufferLine {
|
|
|
|
|
|
|
|
void cellSetWidth(int index, int width) {
|
|
void cellSetWidth(int index, int width) {
|
|
|
_cells.setInt8(index * _cellSize + _cellWidth, width);
|
|
_cells.setInt8(index * _cellSize + _cellWidth, width);
|
|
|
|
|
+ _currentTrimmedLength = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void cellClearFlags(int index) {
|
|
void cellClearFlags(int index) {
|
|
@@ -219,9 +226,13 @@ class BufferLine {
|
|
|
cellSetBgColor(index, cursor.bg);
|
|
cellSetBgColor(index, cursor.bg);
|
|
|
cellSetFlags(index, cursor.flags);
|
|
cellSetFlags(index, cursor.flags);
|
|
|
cellSetWidth(index, 0);
|
|
cellSetWidth(index, 0);
|
|
|
|
|
+ _currentTrimmedLength = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int getTrimmedLength([int? cols]) {
|
|
int getTrimmedLength([int? cols]) {
|
|
|
|
|
+ if (_currentTrimmedLength != null) {
|
|
|
|
|
+ return _currentTrimmedLength!;
|
|
|
|
|
+ }
|
|
|
if (cols == null) {
|
|
if (cols == null) {
|
|
|
cols = _maxCols;
|
|
cols = _maxCols;
|
|
|
}
|
|
}
|
|
@@ -231,9 +242,11 @@ class BufferLine {
|
|
|
for (int j = 0; j <= i; j++) {
|
|
for (int j = 0; j <= i; j++) {
|
|
|
length += cellGetWidth(j);
|
|
length += cellGetWidth(j);
|
|
|
}
|
|
}
|
|
|
|
|
+ _currentTrimmedLength = length;
|
|
|
return length;
|
|
return length;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ _currentTrimmedLength = 0;
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -250,6 +263,7 @@ class BufferLine {
|
|
|
for (var i = 0; i < intsToCopy; i++) {
|
|
for (var i = 0; i < intsToCopy; i++) {
|
|
|
cells[dstStart + i] = srcCells[srcStart + i];
|
|
cells[dstStart + i] = srcCells[srcStart + i];
|
|
|
}
|
|
}
|
|
|
|
|
+ _currentTrimmedLength = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// int cellGetHash(int index) {
|
|
// int cellGetHash(int index) {
|