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

row and col fields in CursorFrame seem to be swapped. #3542

Closed
2 tasks done
ArtBIT opened this issue Mar 26, 2019 · 3 comments
Closed
2 tasks done

row and col fields in CursorFrame seem to be swapped. #3542

ArtBIT opened this issue Mar 26, 2019 · 3 comments

Comments

@ArtBIT
Copy link
Contributor

ArtBIT commented Mar 26, 2019

  • I am on the latest Hyper.app version
  • I have searched the issues of this repo and believe that this is not a duplicate

Issue

The CursorFrame object, returned by the onCursorMove callback, seem to have row and col swapped.

On the very first line of the terminal, col has a value of 0, and row has the value of 23.
If I hit enter, the col has a value of 1, and row has the value of 23.

y coordinate should be mapped to row, and x coordinate should be mapped to col, not the other way around as in: https://github.com/zeit/hyper/blob/8733ecc84ac63c49f82bba868bbd8dcb6e27455b/lib/components/term.js#L177

@ppot
Copy link
Contributor

ppot commented Mar 27, 2019

Could you make a gif of this behavior? Would help. Appreciated.

@ArtBIT
Copy link
Contributor Author

ArtBIT commented Mar 27, 2019

I don't have a visual demo of the problem, but I've linked you to the actual source of the problem:

https://github.com/zeit/hyper/blob/8733ecc84ac63c49f82bba868bbd8dcb6e27455b/lib/components/term.js#L177

          const cursorFrame = {
            x: this.term._core.buffer.x * this.term._core.renderer.dimensions.actualCellWidth,
            y: this.term._core.buffer.y * this.term._core.renderer.dimensions.actualCellHeight,
            width: this.term._core.renderer.dimensions.actualCellWidth,
            height: this.term._core.renderer.dimensions.actualCellHeight,
            col: this.term._core.buffer.y, // this should be x
            row: this.term._core.buffer.x // this should be y
          };

X coordinate identifies in which column we are, and the Y coordinate identifies in which row.
Rows and columns

If the cursor is on line 5, character 23, I expect CursorFrame.row to be 5, and CursorFrame.col to be 23. In reality, onCursorMove returns a CursorFrame object with row set to 23, and col set to 5.

@ArtBIT
Copy link
Contributor Author

ArtBIT commented Mar 27, 2019

I have made a pull request to fix this, but this is a breaking change, and I don't know how do you handle those.

ArtBIT added a commit to ArtBIT/hyper that referenced this issue Mar 27, 2019
@chabou chabou closed this as completed in 72bc73e Mar 27, 2019
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

No branches or pull requests

2 participants