xtext: getSelectedWords returns with indices#2013
Merged
Merged
Conversation
poire-z
approved these changes
Dec 27, 2024
poire-z
left a comment
Contributor
There was a problem hiding this comment.
Fine with me. I'll review the frontend PR later.
| // 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). |
Contributor
There was a problem hiding this comment.
Suggested change
| // 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.)
Contributor
Author
There was a problem hiding this comment.
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
Contributor
Author
|
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.) |
Member
|
We'll just squash it. :-) |
Contributor
You may have been too quick at merging this :/ |
Member
|
Hm, indeed. If necessary I'll force push or revert. |
Frenzie
pushed a commit
to koreader/koreader
that referenced
this pull request
Jan 12, 2025
When selecting text in the dictionary (including Wikipedia) or the pop-up footnotes highlight the selected text using an inverting rectangle. After closing the opened dictionary remove the highlight after a short delay just like in the reader. Depends on koreader/koreader-base#2013
0xstillb
pushed a commit
to 0xstillb/koreader-thai
that referenced
this pull request
May 9, 2026
When selecting text in the dictionary (including Wikipedia) or the pop-up footnotes highlight the selected text using an inverting rectangle. After closing the opened dictionary remove the highlight after a short delay just like in the reader. Depends on koreader/koreader-base#2013
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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