This commit is contained in:
Daniel Imms
2018-12-27 23:58:57 -08:00
parent fa47036982
commit 8bc04c2fa7
2 changed files with 4 additions and 11 deletions
+3 -11
View File
@@ -300,8 +300,8 @@ export class Buffer implements IBuffer {
const countToRemove = wrappedLines.length - destLineIndex - 1; const countToRemove = wrappedLines.length - destLineIndex - 1;
if (countToRemove > 0) { if (countToRemove > 0) {
this.lines.splice(y + wrappedLines.length - countToRemove, countToRemove); this.lines.splice(y + wrappedLines.length - countToRemove, countToRemove);
let removing = countToRemove; let viewportAdjustments = countToRemove;
while (removing-- > 0) { while (viewportAdjustments-- > 0) {
if (this.ybase === 0) { if (this.ybase === 0) {
this.y--; this.y--;
// Add an extra row at the bottom of the viewport // Add an extra row at the bottom of the viewport
@@ -314,7 +314,6 @@ export class Buffer implements IBuffer {
} }
} }
} }
// TODO: Handle list trimming
return wrappedLines.length - countToRemove - 1; return wrappedLines.length - countToRemove - 1;
} }
@@ -326,9 +325,6 @@ export class Buffer implements IBuffer {
return 0; return 0;
} }
// TODO: How is the cursor x handled if it's wrapped? Do something special when the cursor is this line?
// Gather wrapped lines if it's wrapped // Gather wrapped lines if it's wrapped
let lineIndex = y; let lineIndex = y;
let nextLine = this.lines.get(++lineIndex) as BufferLine; let nextLine = this.lines.get(++lineIndex) as BufferLine;
@@ -340,9 +336,6 @@ export class Buffer implements IBuffer {
// Determine how many lines need to be inserted at the end, based on the trimmed length of // Determine how many lines need to be inserted at the end, based on the trimmed length of
// the last wrapped line // the last wrapped line
if (wrappedLines[wrappedLines.length - 1].getTrimmedLength() === undefined) {
debugger;
}
const lastLineLength = wrappedLines[wrappedLines.length - 1].getTrimmedLength(); const lastLineLength = wrappedLines[wrappedLines.length - 1].getTrimmedLength();
const cellsNeeded = (wrappedLines.length - 1) * this._terminal.cols + lastLineLength; const cellsNeeded = (wrappedLines.length - 1) * this._terminal.cols + lastLineLength;
const linesNeeded = Math.ceil(cellsNeeded / newCols); const linesNeeded = Math.ceil(cellsNeeded / newCols);
@@ -351,8 +344,7 @@ export class Buffer implements IBuffer {
// Add the new lines // Add the new lines
const newLines: BufferLine[] = []; const newLines: BufferLine[] = [];
for (let i = 0; i < linesToAdd; i++) { for (let i = 0; i < linesToAdd; i++) {
// TODO: Remove any! const newLine = this.getBlankLine(this._terminal.eraseAttr(), true) as BufferLine;
const newLine = this.getBlankLine((this._terminal as any).eraseAttr(), true) as BufferLine;
newLines.push(newLine); newLines.push(newLine);
} }
this.lines.splice(y + wrappedLines.length, 0, ...newLines); this.lines.splice(y + wrappedLines.length, 0, ...newLines);
+1
View File
@@ -230,6 +230,7 @@ export interface ITerminal extends PublicTerminal, IElementAccessor, IBufferAcce
cancel(ev: Event, force?: boolean): boolean | void; cancel(ev: Event, force?: boolean): boolean | void;
log(text: string): void; log(text: string): void;
showCursor(): void; showCursor(): void;
eraseAttr(): number;
} }
export interface IBufferAccessor { export interface IBufferAccessor {