Skip to content

Commit

Permalink
apply new trimming to linkifier
Browse files Browse the repository at this point in the history
  • Loading branch information
jerch committed Dec 16, 2018
1 parent fb92452 commit c7fa89d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Linkifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class Linkifier extends EventEmitter implements ILinkifier {
// chars will not match anymore at the viewport borders.
const overscanLineLimit = Math.ceil(Linkifier.OVERSCAN_CHAR_LIMIT / this._terminal.cols);
const iterator = this._terminal.buffer.iterator(
false, absoluteRowIndexStart, absoluteRowIndexEnd, overscanLineLimit, overscanLineLimit);
true, absoluteRowIndexStart, absoluteRowIndexEnd, overscanLineLimit, overscanLineLimit);
while (iterator.hasNext()) {
const lineData: IBufferStringIteratorResult = iterator.next();
for (let i = 0; i < this._linkMatchers.length; i++) {
Expand Down Expand Up @@ -220,12 +220,12 @@ export class Linkifier extends EventEmitter implements ILinkifier {
rex.lastIndex = stringIndex + uri.length;

// get the buffer index as [absolute row, col] for the match
const bufferIndex = this._terminal.buffer.stringIndexToBufferIndex(rowIndex, stringIndex, false);
const bufferIndex = this._terminal.buffer.stringIndexToBufferIndex(rowIndex, stringIndex, true);
// calculate buffer index of uri end
// we cannot directly use uri.length here since stringIndexToBufferIndex would
// skip empty cells and stop at the next cell with real content
// instead we fetch the index of the last char in uri and advance to the next cell
const endIndex = this._terminal.buffer.stringIndexToBufferIndex(rowIndex, stringIndex + uri.length - 1, false);
const endIndex = this._terminal.buffer.stringIndexToBufferIndex(rowIndex, stringIndex + uri.length - 1, true);

// adjust start index to visible line length
if (bufferIndex[1] >= this._terminal.cols) {
Expand Down

0 comments on commit c7fa89d

Please sign in to comment.