-
Notifications
You must be signed in to change notification settings - Fork 236
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
Make highlights respect word selection mode #742
base: main
Are you sure you want to change the base?
Conversation
No, I guess we'll have to try both and see which one works better. |
09f05db
to
459228a
Compare
Taking the centre along the vertical axis seems to work reasonably well. I've tested this on a handful of documents, including an RTL document from https://fa.wikipedia.org/w/index.php?title=%D9%88%DB%8C%DA%98%D9%87:DownloadAsPdf&page=%D8%B2%D8%A8%D8%A7%D9%86_%D9%81%D8%A7%D8%B1%D8%B3%DB%8C&action=show-download-screen |
459228a
to
0596adf
Compare
I'm observing some issues with one of my documents. I will look into this before reopening this. |
I will be testing this during the next few days of ordinary usage. Migrating existing highlights is going to be an issue for those that relied on word selection mode, I think. Most of my past highlights don't cover the beginning and ending of their first and last word, respectively. |
d5c85fa allows preserving the old rendering behaviour of highlights read from the database. |
The latest change allows replacing individual highlights with ones with updated start and end points. I haven't experienced any issues with my changes these days. If needed, I can add an The only part missing in my eyes would be to document this change and potential workarounds (either setting |
Thanks for your awesome work. Note that I am working on the next version of sioyek (as I have described here: #734 (comment)), which will be a major release and changes many aspects of sioyek including database schema. For example things like this will be different in new sioyek:
because now every highlight will have a unique UUID which makes it simple to just update a highlight's properties instead of deleting and re-adding it. |
That's great news, and thanks for the heads-up. I'd be happy to integrate the changes once you think that your private branch is ready --- ideally shortly before you make a new release to bundle non-trivial changes, but of course I'm fine with whatever timeline you think makes sense. |
The word selection state may be relevant after the mouse button has been released
This seems to stabilise selections that involve characters such as full stops.
This allows highlights to be expanded to entail entire words when read from the database or when embedded into PDF files.
This effectively replaces a selected highlight by one with the original start and end point modified to match the selection's word boundaries.
2762ecb
to
bf7fda2
Compare
Should I try to adapt this to the development version? I haven't been able to run the development version yet, possibly because of the shaders not compiling at runtime for some reason. Does it make sense to have this ready before the next release? |
I think I may have forgotten about this PR and have implemented parts of this myself :/. So it definitely needs some adapting before beings accepted. Alternatively if you are busy and there are still issues with the development version you could open an issue and I will implement it myself. |
That's completely fine -- I'll open an issue. Most of it was fairly straightforward. Getting 189b82a right was what took most of the time -- feel free to use this in whatever way you see fit. |
Right, I created one back in June: #741 |
Fixes #741. Selections are saved using start and end positions, which usually result in two different selections depending on whether
exact_highlight_select
is set. Ideally the selection and resulting highlights should coincide across sessions, be consistent with each other, and be stable when embedding into a PDF file.The main issue with this is that the word selection mode is not persisted in the database. To work around this I attempted to change the selection start and end positions, which often causes too much text to be highlighted when reloading the highlights from the database. I'll try to see if those using the character boxes centres helps. Alternatively I'll try move the selection start and end points such that there is no overlap with other character boxes. Do you have any thoughts on this, @ahrm?
Two minor tasks remain: