-
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
Avoid drawing hidden text in DocView:draw_line_text
#1298
Avoid drawing hidden text in DocView:draw_line_text
#1298
Conversation
DocView:draw_line_text
DocView:draw_line_text
Does this means ability to open a file with really long lines and not having the editor choke? |
It surely helps, but only on lines where the tokens aren't extremely long. |
As discussed on discord: It is probably better to do a quick clip check in the rencache for the first bit, to avoid the double width computation; also has the added benefit of just generally probably slimming down the rencache. We should know the current clip in C at the time of sending the command, so I can't think of a reason why that wouldn't work. |
ceae855
to
cfc9e77
Compare
The check was previously done with the window rect, so this will reduce a bit more the number of commands sent.
cfc9e77
to
19dec0f
Compare
Thanks to Adam's suggestions:
|
Looks good. Tested, and works fine. Still chokes on large files, but as you say, almost assuredly better, and don't see any rendering errors. Merging. |
* Stop drawing text past the `DocView` edge in `DocView:draw_line_text` * Don't add draw commands if they fall outside the latest clip The check was previously done with the window rect, so this will reduce a bit more the number of commands sent.
* Stop drawing text past the `DocView` edge in `DocView:draw_line_text` * Don't add draw commands if they fall outside the latest clip The check was previously done with the window rect, so this will reduce a bit more the number of commands sent.
With this PR, we no longer send hidden (tokenized) text to the renderer.
Non tokenized text or text tokenized as long strings is still a problem, which can be solved by splitting the tokenized text into smaller pieces.
Here there might be a performance impact caused by having to call
font:get_width
, but this needs testing.