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

Use getregion() for showing definition of selected texts #1508

Merged

Conversation

ychin
Copy link
Member

@ychin ychin commented Oct 31, 2024

Previously, MacVim added custom VimScript to query what the user selected text is before calling showdefinition on it. Since Vim has since implemented the getregion() API that provides that info natively, use that API instead of the custom implementation.

Also, the previous implementation was broken when dealing with wide characters where it would select more characters than necessary. Using the native getregion() is much more robust and handle those situations.

Previously, MacVim added custom VimScript to query what the user
selected text is before calling `showdefinition` on it. Since Vim has
since implemented the `getregion()` API that provides that info
natively, use that API instead of the custom implementation.

Also, the previous implementation was broken when dealing with wide
characters where it would select more characters than necessary. Using
the native `getregion()` is much more robust and handle those
situations.
@ychin ychin added this to the Release 181 milestone Oct 31, 2024
@ychin
Copy link
Member Author

ychin commented Oct 31, 2024

Also, the previous implementation was broken when dealing with wide characters where it would select more characters than necessary.

Just as an example of the current bug, if you paste in the Chinese text from the Hawaii Wikipedia article (Chinese version): "夏威夷州是位於美國西部的州", and then select "夏威夷" (Hawaii) and right click -> Look Up, current Vim shows this where it somehow thinks we have selected "夏威夷州是位於":

image

@ychin ychin merged commit 45c5509 into macvim-dev:master Oct 31, 2024
4 of 5 checks passed
@ychin ychin deleted the showdefinition-selection-use-getregion branch October 31, 2024 05:47
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.

1 participant