question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider changing null cell data to all zeros

See original GitHub issue

On resize when the cols in the terminal increases, we fill in cell data at the end of the buffer here:

https://github.com/xtermjs/xterm.js/blob/1431210ecddebcc180002f1277473191abbe8694/src/common/buffer/BufferLine.ts#L353

This is doing a relatively large amount of work as each individual index of the cell needs to be set directly off the cell object:

https://github.com/xtermjs/xterm.js/blob/1431210ecddebcc180002f1277473191abbe8694/src/common/buffer/BufferLine.ts#L218-L220

If we made “null cell data” all zeroes, we could then use a single typed array fill call, at least when the fill data is all default background and foreground colors which is the typical case.

This would involve either adapting the code so null cells have a width of 0 instead of 1, or change a cell’s width=1 to actually be encoded as 0 << Conten.WIDTH_SHIFT:

https://github.com/xtermjs/xterm.js/blob/1431210ecddebcc180002f1277473191abbe8694/src/common/buffer/CellData.ts#L83

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jerchcommented, Sep 30, 2022

Yeah - that summarizes it pretty well, sadly. And putting such a hack in place is dangerous, in several months no ones remembers exactly it was all about and boom 🙈

1reaction
jerchcommented, Sep 30, 2022

Ah well I meant it this way - if we just fill all excess uint32 slots from current NULL_CELL.CONTENT value it should just work, because it will just contain (1<<22) in all slots, thus also for FG and BG, where it is technically wrong. But it is not harmful, as the FG/BG value dont eval the lower 3 bytes (RGB section, thus bit 1…24) since CM_MASK is zero. (For CM_MASK==0 the RGB section has no meaning in FG/BG.) I know thats quite hacky, thus my warning about a proper doc note, if we’d go that route.

In summary we’d only need to do:

  • fill excess uint32 slots from current NULL_CELL.CONTENT
  • place proper doc warning about “width in NULL_CELL.CONTENT must always map into non-evaled regions in FG & BG”
  • and better never touch NULL_CELL repr again (to avoid clashing with that rule)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Replace NULL or Missing Data With Zeros or Existing Data
All options will replace NULL data with zeros. Options 3, 4, and 5 will replace missing data with zeros. Options 2, 3, and...
Read more >
How to Replace Blank Cells in Excel with Zeros (0), Dashes (-)
Select Blanks in the Go To Special dialog box and click OK. Excel will select all of the blank cells within the range....
Read more >
Transform NULL and N/A cells into blank or zero or deleting ...
Looking answer related to the situations when: Transforming NULL and N/A cells into blank or Transforming NULL and N/A cels into zero.
Read more >
How to Replace Zeros with Blank Cells in an Excel Worksheet
The easy way to find and fix zeros or any other value is with Excel's Find/Replace function. Open your worksheet and either 1)...
Read more >
How to Replace Blank Cells with Zeros in Excel Pivot Tables
Right-click any cell in the Pivot Table and select Pivot Table Options. · In Pivot Table Options Dialogue Box, within the Layout &...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found