-
Notifications
You must be signed in to change notification settings - Fork 108
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
xtext: getSelectedWords returns with indices #2013
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me. I'll review the frontend PR later.
xtext.cpp
Outdated
// Get (as a single UTF-8 string) the segment of m_text, extended to include | ||
// the full words that may be cut at boundaries (start, end). | ||
void getSelectedWords(int start, int end, int context) { | ||
// Get extended start and end indices that include the full words that may be cut at boundaries (start, end). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Get extended start and end indices that include the full words that may be cut at boundaries (start, end). | |
// Get start and end indices of an extended segment of m_text that includes the full words that may be cut at boundaries (start, end). |
(Just for clarity, "extended indices" reads odd to me.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the comments.
Rename getSelectedWords to getSelectedWordIndices, and return the word boundary indices instead of the words. This is needed for highlighting. The words themselves can obtained by passing the indices to the getText function. Warning! Breaking change.
2fb4f9e
to
734eb01
Compare
I introduced and off by one error, so I added a small fix commit. (I did not want to use force push because it is two character change.) |
We'll just squash it. :-) |
You may have been too quick at merging this :/ |
Hm, indeed. If necessary I'll force push or revert. |
Rename getSelectedWords to getSelectedWordIndices, and return the word boundary indices instead of the words. This is needed for highlighting. The words themselves can be obtained by passing the indices to the getText function.
Warning! Breaking change.
This change is