move _data from BufferLine to new LogicalLine class#5797
move _data from BufferLine to new LogicalLine class#5797PerBothner wants to merge 5 commits intoxtermjs:masterfrom
Conversation
Instead to change isWrapped state use a Buffer.setWrapped method. This allows for potential flexibility in how BufferLine and line-wrapping are implemented.
A BufferLine is now the sub-range of a LogicalLine for a specific visible line, while LogicalLine is independent of window width.
|
Note this PR assumes PR #5788 has been merged first. |
|
FWIW, I'm looking into adding (A possible future improvement I'm thinking about is to store the actual values of |
|
I merged from upstream/master (with some effort thanks to the new string aching). However, the image addon breaks the BuferLine abstraction. I'll take a look at that shortly. I may focus on fixing that in the context PR #5853, which I haven't merged yet. (I would also like to further simplify the reflow logic, which I hope allow me fix the remaining testsuite failures.) |
This moves cell data from a
BufferLineinto a newLogicalLineclass which contains the actual data for a line. This data does not change ifBufferwidth changes. EachLogicalLineis rendered as one or moreBufferLines, depending on terminal width; conversely eachBufferLinespecifies a sub-range of the parentLogicalLine.This implements issue #5673 .
Some benefits:
Buffer.resize.No need for cleaning up memory after resize.
getBlankLine.LogicalLineis the "model" (conceptual buffer data) while the set ofBufferLinesis the "view" (how the LogicalView is rendered given a specifical line width).Memory cleanup: There is no need for queing up memory-cleanup items when doing a resize, since resize doesn't create garbage (except when lines are trimmed). However, it may be worthwhile doing memory cleanup when lines are erased and/or when lines are unwrapped (commonly done together). We might also cleanup memory when lines move out above
ybase.Merging BufferReflow.ts into Buffer.ts: An optional follow-up would be to merge the rest of
BufferReflow.tsintoBuffer.ts- since there isn't much left inBufferReflow.ts. See this changeset. That would make more slightly more efficient and (in my opinion) more readable code, but I didn't do this in the interest of a more manageable PR.