|
@@ -103,7 +103,7 @@ class Buffer {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void newLine() {
|
|
void newLine() {
|
|
|
- if (terminal.lineFeed == false) {
|
|
|
|
|
|
|
+ if (terminal.newLineMode) {
|
|
|
setCursorX(0);
|
|
setCursorX(0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -125,6 +125,10 @@ class Buffer {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
List<BufferLine> getVisibleLines() {
|
|
List<BufferLine> getVisibleLines() {
|
|
|
|
|
+ if (height < terminal.viewHeight) {
|
|
|
|
|
+ return lines.toList();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
final result = <BufferLine>[];
|
|
final result = <BufferLine>[];
|
|
|
|
|
|
|
|
for (var i = height - terminal.viewHeight; i < height; i++) {
|
|
for (var i = height - terminal.viewHeight; i < height; i++) {
|
|
@@ -217,7 +221,13 @@ class Buffer {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /// https://vt100.net/docs/vt100-ug/chapter3.html#IND
|
|
|
|
|
|
|
+ /// https://vt100.net/docs/vt100-ug/chapter3.html#IND IND – Index
|
|
|
|
|
+ ///
|
|
|
|
|
+ /// ESC D
|
|
|
|
|
+ ///
|
|
|
|
|
+ /// [index] causes the active position to move downward one line without
|
|
|
|
|
+ /// changing the column position. If the active position is at the bottom
|
|
|
|
|
+ /// margin, a scroll up is performed.
|
|
|
void index() {
|
|
void index() {
|
|
|
if (isInScrollableRegion) {
|
|
if (isInScrollableRegion) {
|
|
|
if (_cursorY < _marginBottom) {
|
|
if (_cursorY < _marginBottom) {
|
|
@@ -228,13 +238,18 @@ class Buffer {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // the cursor is not in the scrollable region
|
|
|
if (_cursorY >= terminal.viewHeight - 1) {
|
|
if (_cursorY >= terminal.viewHeight - 1) {
|
|
|
|
|
+ // we are ait the bottom so a new line is created.
|
|
|
lines.add(BufferLine());
|
|
lines.add(BufferLine());
|
|
|
|
|
+
|
|
|
|
|
+ // clean extra lines if needed.
|
|
|
final maxLines = terminal.maxLines;
|
|
final maxLines = terminal.maxLines;
|
|
|
if (maxLines != null && lines.length > maxLines) {
|
|
if (maxLines != null && lines.length > maxLines) {
|
|
|
lines.removeRange(0, lines.length - maxLines);
|
|
lines.removeRange(0, lines.length - maxLines);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ // there're still lines so we simply move cursor down.
|
|
|
moveCursorY(1);
|
|
moveCursorY(1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|