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

Fixed mouse coords for big terminals (>=96 columns) #1

Closed
wants to merge 1 commit into from
Closed

Fixed mouse coords for big terminals (>=96 columns) #1

wants to merge 1 commit into from

Conversation

smetana
Copy link

@smetana smetana commented Jun 5, 2017

For columns >=96 mouse event data has bytes which
cannot be correctly converted to utf8 string.
Result string will have utf8 replacement character
with charcode 65533 and all columns >= 96 will be
incorrectly counted as 65501

Use readUInt8 directly on buffer to get correct
column.

replacement character for nonexistent UTF8 symbol

For columns >=96 mouse event data has bytes which
cannot be correctly converted to utf8 string.
Result string will have utf8 replacement character
with charcode 65533 and all columns >= 96 will be
incorrectly counted as 65501

Use readUInt8 directly on buffer to get correct
column.

replacement character for nonexistent UTF8 symbol
@CoderPuppy
Copy link
Owner

Sorry for taking a while to notice this.

In the standard mouse reporting mode, coordinates are encoded as bytes. But this enables 1005 which encodes the coordinates as UTF-8. So if it's not working it's because your terminal doesn't support that.

I'll rework this to use standard mouse reporting as well as 1006 and 1015 both of which write out the numbers in ASCII (and possibly still 1005) which should fix this.

@CoderPuppy
Copy link
Owner

I pushed code to the dev branch which should fix this. I'm not entirely sure it's backwards compatible and I don't have any projects that use this to test it with, so could you try it and tell me if it works?

@smetana
Copy link
Author

smetana commented Jun 14, 2017

It works! Thank you

@CoderPuppy
Copy link
Owner

Great, published as v0.2.0!

@CoderPuppy CoderPuppy closed this Jun 14, 2017
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.

None yet

2 participants