Skip to content

Support link position in hover tooltip callback#2470

Merged
Tyriar merged 5 commits intoxtermjs:masterfrom
jmbockhorst:linkPosition
Oct 18, 2019
Merged

Support link position in hover tooltip callback#2470
Tyriar merged 5 commits intoxtermjs:masterfrom
jmbockhorst:linkPosition

Conversation

@jmbockhorst
Copy link
Copy Markdown
Contributor

@jmbockhorst jmbockhorst commented Oct 14, 2019

Added support for link position in the hover tooltip callback and tested that it works in the demo.
I defined ILinkLocation in both the public API and the browser types. I know that this probably isn't correct, but I wasn't sure how to get around it. Closes #2468.

Copy link
Copy Markdown
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

Thanks @jmbockhorst, I haven't tested it but this looks good. We mainly just need to figure out what naming we want to commit to

@Tyriar Tyriar added this to the 4.2.0 milestone Oct 16, 2019
Copy link
Copy Markdown
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

@jmbockhorst let's change the API to use this instead:

interface IViewportRange {
  start: IViewportCellPosition;
  end: IViewportCellPosition;
}
interface IViewportCellPosition {
  col: number;
  row: number;
}

I created #2480 to make ISelectionPosition more consistent for v5

matcher.hoverTooltipCallback(e, uri);
// 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 } });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I made a change to expose this as a 1-based number to align with https://invisible-island.net/xterm/ctlseqs/ctlseqs.html. It's looks a little weird how the end col doesn't add 1 but I guess that's how the mouse zones work right now, they include everything up to but excluding the end cell

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you forget col: x2 here? Shouldn't it be col: x2 + 1 as like the others?

@Tyriar
Copy link
Copy Markdown
Member

Tyriar commented Oct 17, 2019

@mofux the right numbers are coming through like that, I think mouse zone uses coords a little strangely (I wrote it 😅) and the end isn't included in the range

@Tyriar
Copy link
Copy Markdown
Member

Tyriar commented Oct 17, 2019

image
image

image
image

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support link matcher start position

4 participants