Remove TODOs, polish

This commit is contained in:
Daniel Imms
2018-03-09 10:56:54 -08:00
parent 4ddf91dbbe
commit b44a11c42e
+4 -5
View File
@@ -157,18 +157,19 @@ export class Linkifier extends EventEmitter implements ILinkifier {
* @param rowIndex The index of the row to linkify. * @param rowIndex The index of the row to linkify.
*/ */
private _linkifyRow(rowIndex: number): void { private _linkifyRow(rowIndex: number): void {
// Ensure the row exists
const absoluteRowIndex = this._terminal.buffer.ydisp + rowIndex; const absoluteRowIndex = this._terminal.buffer.ydisp + rowIndex;
if (absoluteRowIndex >= this._terminal.buffer.lines.length) { if (absoluteRowIndex >= this._terminal.buffer.lines.length) {
return; return;
} }
// Only attempt to linkify rows that start in the viewport
if ((<any>this._terminal.buffer.lines.get(absoluteRowIndex)).isWrapped) { if ((<any>this._terminal.buffer.lines.get(absoluteRowIndex)).isWrapped) {
// TODO: Make sure if a wrapped line is requested to be linkified it gets backtracked to ensure the link is filled
return; return;
} }
let text = this._terminal.buffer.translateBufferLineToString(absoluteRowIndex, false);
// Construct full unwrapped line text // Construct full unwrapped line text
let text = this._terminal.buffer.translateBufferLineToString(absoluteRowIndex, false);
let currentIndex = absoluteRowIndex + 1; let currentIndex = absoluteRowIndex + 1;
while (currentIndex < this._terminal.buffer.lines.length && while (currentIndex < this._terminal.buffer.lines.length &&
(<any>this._terminal.buffer.lines.get(currentIndex)).isWrapped) { (<any>this._terminal.buffer.lines.get(currentIndex)).isWrapped) {
@@ -234,7 +235,6 @@ export class Linkifier extends EventEmitter implements ILinkifier {
* @param matcher The link matcher for the link. * @param matcher The link matcher for the link.
*/ */
private _addLink(x: number, y: number, uri: string, matcher: ILinkMatcher): void { private _addLink(x: number, y: number, uri: string, matcher: ILinkMatcher): void {
// TODO: Make MouseZone's work over multiple lines
this._mouseZoneManager.add(new MouseZone( this._mouseZoneManager.add(new MouseZone(
x + 1, x + 1,
y + 1, y + 1,
@@ -276,7 +276,6 @@ export class Linkifier extends EventEmitter implements ILinkifier {
return { return {
x1: x, x1: x,
y1: y, y1: y,
// TODO: Verify links on boundary work fine (x vs x + 1)
x2: (x + uri.length) % this._terminal.cols, x2: (x + uri.length) % this._terminal.cols,
y2: y + Math.floor((x + uri.length) / this._terminal.cols), y2: y + Math.floor((x + uri.length) / this._terminal.cols),
cols: this._terminal.cols cols: this._terminal.cols