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

xterm-addon-web-links IViewportRange in hover callback is offset by 1 #4247

Closed
Coding-Kiwi opened this issue Oct 31, 2022 · 1 comment · Fixed by #4288
Closed

xterm-addon-web-links IViewportRange in hover callback is offset by 1 #4247

Coding-Kiwi opened this issue Oct 31, 2022 · 1 comment · Fixed by #4288
Labels
area/api type/bug Something is misbehaving
Milestone

Comments

@Coding-Kiwi
Copy link
Contributor

I have a line with a link:

image

Its the first line (row) of the terminal.

When I select something in the line and call terminal.getSelectionPosition, the start and end row is 0, this is what I would expect
When I hover the link and receive the location from the WebLinkProvider hover callback the start and end row is 1

Details

  • Browser and browser version: Electron 21.2.0
  • OS version: Windows 11
  • xterm.js version: 5.0.0
  • xterm-addon-web-links 0.7.0

Steps to reproduce

  1. have a line with text and link
  2. have xterm-addon-web-links with hover callback
  3. select text, call getSelectionPosition
  4. hover link, receive location
  5. compare rows of locations
@Coding-Kiwi Coding-Kiwi changed the title xterm-addon-web-links xterm-addon-web-links IViewportRange in hover callback is offset by 1 Oct 31, 2022
@Tyriar Tyriar added type/bug Something is misbehaving area/api labels Dec 1, 2022
@Tyriar
Copy link
Member

Tyriar commented Dec 1, 2022

I'd expect this is 0-based but following IBufferRange says it should be 1-based:

xterm.js/typings/xterm.d.ts

Lines 1244 to 1272 in 4451369

/**
* A range within a buffer.
*/
interface IBufferRange {
/**
* The start position of the range.
*/
start: IBufferCellPosition;
/**
* The end position of the range.
*/
end: IBufferCellPosition;
}
/**
* A position within a buffer.
*/
interface IBufferCellPosition {
/**
* The x position within the buffer (1-based).
*/
x: number;
/**
* The y position within the buffer (1-based).
*/
y: number;
}

@jerch jerch mentioned this issue Dec 8, 2022
4 tasks
@Tyriar Tyriar added this to the 5.1.0 milestone Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api type/bug Something is misbehaving
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants