From 83508048585ec5c7d5322c27d9d2c9f7d3949d86 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 17 Oct 2019 12:36:03 -0700 Subject: [PATCH] Adjust to use 1-based, note in API --- src/browser/Linkifier.ts | 4 +++- typings/xterm.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/browser/Linkifier.ts b/src/browser/Linkifier.ts index 0b51d43f..ecaf8af9 100644 --- a/src/browser/Linkifier.ts +++ b/src/browser/Linkifier.ts @@ -306,7 +306,9 @@ export class Linkifier implements ILinkifier { e => { this._onLinkTooltip.fire(this._createLinkHoverEvent(x1, y1, x2, y2, fg)); if (matcher.hoverTooltipCallback) { - matcher.hoverTooltipCallback(e, uri, { start: { row: y1, col: x1 }, end: { row: y2, col: x2 } }); + // Note that IViewportRange use 1-based coordinates to align with escape sequences such + // as CUP which use 1,1 as the default for row/col + matcher.hoverTooltipCallback(e, uri, { start: { row: y1 + 1, col: x1 + 1 }, end: { row: y2 + 1, col: x2 } }); } }, () => { diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index e7b2247e..c1f5eab9 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -862,12 +862,12 @@ declare module 'xterm' { */ interface IViewportCellPosition { /** - * The column of the cell. + * The column of the cell. Note that this is 1-based; the first column is column 1. */ col: number; /** - * The row of the cell. + * The row of the cell. Note that this is 1-based; the first row is row 1. */ row: number; }