refactor(dom): removes double buffering from DomBackend#138
refactor(dom): removes double buffering from DomBackend#138junkdog merged 28 commits intoratatui:mainfrom
DomBackend#138Conversation
for now, breaking cursor and resize ratatui#135
DomBackend structDomBackend struct
DomBackend structDomBackend
|
Nice, looking pretty good already. Let me know when this is ready for a review :) |
|
I added the example from #121.
Also I removed this if cell.modifier.contains(HYPERLINK_MODIFIER) {
continue;
}so that hyperlinks are rendered even if they are not supported after this PR. (the I’m excited to hear your feedback! |
|
Hi, let me know when you can review this. I have some time to work on changes if needed :) |
but also more stable framerate |
orhun
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I'm experiencing some issues while running this. (see the video that I attached)
|
I'm running from aeec0fe now and the unicode example looks like this (still): Peek.2026-01-09.17-42.mp4Only the DOM backend is a bit broken. Environment:
|
Uhm, that's bad, I can't reproduce this issue. I'm using trunk and rustc with the same version you specified. However, I'm running Firefox version 146.0.1 (I can't install a specific version at the moment). Do you have any other idea that can help me reproduce this bug ? |
|
Okay I figured it out... nothing wrong with the code. I had the Translate Web Pages plugin installed which automatically translates the Japanese characters which then breaks the layout... I disabled the plugin and now it all works fine! |
Nice ! I will refactor the |
|
cool, thanks! |
|
Everything should be fixed now, but let's see if junkdog will spot something :) Also, no pressure, but when do you plan to publish the next release Ohrun? |
|
Not sure, probably soon after we finish this one :) |
i'm trying to wrap up beamterm 0.13.0 but it's maybe a week away. |
Are the examples you are running available somewhere ?
Don't hesitate to ping me for things related to this backend in the future.
Nice ! |
oh, that's just ratzilla's demo example.
please do :) i don't think we have an issue for it (or maybe we do), i just know that canvas and dom backends have hard-coded fonts (and font cell metrics are more like guesses, but that might be partially fixed now). it would be nice, if we in the future could just call |



Summary
This PR reworks the DOM backend to fix several bugs and simplify its implementation.
Details
drawfunction for rendering widgets and handling the cursor (hyperlinks are not supported yet).bufferandprev_bufferlogic, reducing complexity.Test
TODO
hyperlinks support in order to fix Hyperlink in DOM backend does not update and disappears on window resize #137 (look at Deprecate Hyperlink widget #113 for direction)Explanation
rendering of the content:
<span>elements once with thepopulatefunction (similar to theprerenderfunction)drawfunction:width: 2chtostyleattribute of the corresponding<span>, render a blank char to the followingspanwith width 0.resizing:
get_sizefunction inutils.rs(that works likeget_sized_buffer)sizefield inDomBackendinitialized to the output ofget_sizesizefunction withget_sizecursor:
last_cursor_positionfield toDomBackendcursor_positionandlast_cursor_position