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

file in GBK encoded line jump to wrong place #27

Closed
gggin opened this issue Nov 17, 2016 · 5 comments
Closed

file in GBK encoded line jump to wrong place #27

gggin opened this issue Nov 17, 2016 · 5 comments

Comments

@gggin
Copy link

gggin commented Nov 17, 2016

if GBK encoded,
find then click position in codes
it jump wrong position

@rpaquay
Copy link
Contributor

rpaquay commented Nov 17, 2016

Note: This happens with all variable byte length encoding types (e.g. utf8). The issue is that VSChromium treats byte offsets the same as character offsets for all encoding types except UTF-16.

rpaquay added a commit that referenced this issue Nov 17, 2016
VsChromium incorrectly treats byte offsets as character offsets.
This works for simple ascii encoding, but creates issues with variable
length encoding, such as UTF8 and GBK.

To mitigate this problem, VsChromium now uses the (line, column)
information when navigating to a code search result. The
(line, column) pair is translated by the VS Editor into a character
offset.

This is not a 100% correct solution, as other part of VsChromium
also rely on the byte offset == character offset assumption, but
this CL fixes the most obvious user-facing issue (e.g. navigation).

Note that this issue does not apply to UTF16 files, as VsChromium
correctly translates character offset = byte offset / 2.
@gggin
Copy link
Author

gggin commented Nov 18, 2016

I understand the reason... will you fix this?

@rpaquay
Copy link
Contributor

rpaquay commented Nov 18, 2016

Yes. I made a (partial) fix in c713abf

@gggin
Copy link
Author

gggin commented Nov 18, 2016

thank you

@gggin gggin closed this as completed Nov 18, 2016
@rpaquay
Copy link
Contributor

rpaquay commented Nov 18, 2016

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