Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine IViewportRange API to use 'cursor positions' for x value #2512

Merged
merged 1 commit into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/browser/Linkifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export class Linkifier implements ILinkifier {
if (matcher.hoverTooltipCallback) {
// 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 } });
matcher.hoverTooltipCallback(e, uri, { start: { x: x1, y: y1 }, end: { x: x2, y: y2 } });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a win compared to the left side 👍.

}
},
() => {
Expand Down
10 changes: 5 additions & 5 deletions src/browser/Types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ export interface IViewport extends IDisposable {
}

export interface IViewportRange {
start: IViewportCellPosition;
end: IViewportCellPosition;
start: IViewportRangePosition;
end: IViewportRangePosition;
}

export interface IViewportCellPosition {
col: number;
row: number;
export interface IViewportRangePosition {
x: number;
y: number;
}

export type LinkMatcherHandler = (event: MouseEvent, uri: string) => void;
Expand Down
23 changes: 14 additions & 9 deletions typings/xterm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,29 +862,34 @@ declare module 'xterm' {
*/
export interface IViewportRange {
/**
* The start cell of the range.
* The start of the range.
*/
start: IViewportCellPosition;
start: IViewportRangePosition;

/**
* The end cell of the range.
* The end of the range.
*/
end: IViewportCellPosition;
end: IViewportRangePosition;
}

/**
* An object representing a cell position within the viewport of the terminal.
*/
interface IViewportCellPosition {
interface IViewportRangePosition {
/**
* The column of the cell. Note that this is 1-based; the first column is column 1.
* The x position of the cell. This is a 0-based index that refers to the
* space in between columns, not the column itself. Index 0 refers to the
* left side of the viewport, index `Terminal.cols` refers to the right side
* of the viewport. This can be thought of as how a cursor is positioned in
* a text editor.
*/
col: number;
x: number;

/**
* The row of the cell. Note that this is 1-based; the first row is row 1.
* The y position of the cell. This is a 0-based index that refers to a
* specific row.
*/
row: number;
y: number;
}

/**
Expand Down