84 Commits

Author SHA1 Message Date
Mitchell Hashimoto
8b02d3430c terminal: copy hyperlinks on reflow 2024-07-05 21:40:39 -07:00
Mitchell Hashimoto
961a4b6b31 terminal: support page oom with hyperlinks 2024-07-05 21:40:39 -07:00
Mitchell Hashimoto
dea8859e2c Merge pull request #1925 from ghostty-org/styleref
terminal: when adjusting page capacity, account for cursor ref counts
2024-07-05 21:38:54 -07:00
Mitchell Hashimoto
92ffa9af13 terminal: when adjusting page capacity, account for cursor ref counts
This fixes an issue where when we adjusted the capacity of the page, the
style ref count would be off by one (short by one).

The issue is that when adjusting the capacity of a page, it happens on
PageList which is unware of cursor state and therefore can't ensure to
reference the active style.

This creates an `adjustCapacity` call on `Screen` which can properly
handle this scenario.
2024-07-05 21:33:05 -07:00
Mitchell Hashimoto
c02481530a terminal: Pin.isBetween incorrect if same y and same page 2024-07-05 19:06:57 -07:00
Mitchell Hashimoto
b62806360b terminal: add test for pagelist to clear styles 2024-06-24 20:58:11 -07:00
Qwerasd
6f732cca55 RefCountedSet: use usize for cap to allow up to max Id+1 2024-06-24 20:32:22 -07:00
Qwerasd
a7e6f1a070 fix(terminal/PageList): clear cells in truncated rows during clone
Previously this was a memory leak, styles and graphemes in these rows
were never reclaimed.
2024-06-24 20:32:21 -07:00
Qwerasd
9741b3a18c perf: introduce RefCountedSet structure, use it for Style.Set 2024-06-13 22:59:03 -04:00
Mitchell Hashimoto
cd42888182 terminal: eraseRows sets dirty bits 2024-05-07 10:38:27 -07:00
Mitchell Hashimoto
f975861891 terminal: maintain dirty bits when rotating rows on clone 2024-05-07 10:36:54 -07:00
Mitchell Hashimoto
3cfce658c3 terminal: dirty tracking in more places, tests coverage 2024-05-07 09:52:03 -07:00
Mitchell Hashimoto
7e52f94278 terminal: on clone, only mark rows dirty that were previously dirty 2024-05-01 20:31:49 -07:00
Mitchell Hashimoto
d47f14f86a terminal: dirty tracking on screen clone 2024-05-01 20:31:49 -07:00
Mitchell Hashimoto
f867fabf8e terminal: new coordinate type 2024-05-01 20:31:49 -07:00
Mitchell Hashimoto
19ddbbc7d6 terminal: eraseRowBounded dirty tracking 2024-05-01 20:31:48 -07:00
Mitchell Hashimoto
f7a57bd2c8 terminal: dirty tests on t/b/l/r margins 2024-05-01 20:31:48 -07:00
Mitchell Hashimoto
981f031951 terminal: remove unused debug log 2024-05-01 20:31:48 -07:00
Mitchell Hashimoto
11c195e493 terminal: dirty tracking on print with tests 2024-05-01 20:31:48 -07:00
Mitchell Hashimoto
7b750b7ed9 terminal: add dirty bits to the page structure 2024-05-01 20:31:48 -07:00
Mitchell Hashimoto
3f16234f72 terminal: Coordinate uses CellCountInt 2024-04-26 20:52:08 -07:00
Mitchell Hashimoto
733ce19654 terminal: handle case where eraseRowBounded happens at top of page
Fixes #1677

If eraseRowBounded is called at the top of a page AND there is a tracked
pin at the top of the page, then we'd have an integer overflow. The test
case covers this and this adds a fix.
2024-04-13 20:45:39 -07:00
Mitchell Hashimoto
dce96847a9 terminal: test eraseRowBounded, fix off by ones 2024-03-27 20:23:45 -07:00
Mitchell Hashimoto
050e6e4daa terminal: when growing rows, need to set rows before grow()
grow() will not prune pages that are needed for the active but that
requires an accurate self.rows. We were setting this too late.
2024-03-27 10:38:31 -07:00
Qwerasd
492e147e26 terminal: clean up some code and comments 2024-03-26 12:07:35 -06:00
Qwerasd
23d32e248e perf(terminal): fast-paths for scrolling regions 2024-03-26 12:07:35 -06:00
Qwerasd
d74ea89056 fastmem: rotateOnce 2024-03-26 12:07:35 -06:00
Qwerasd
ddd7f3e706 comments 2024-03-26 12:07:35 -06:00
Qwerasd
9df9c999a7 fix(terminal): clear erased rows
Clearing these rows is necessary to avoid memory corruption, but the
calls to `clearCells` in the first loop were redundant, since the rows
in question are included in the second loop as well.
2024-03-26 12:07:35 -06:00
Qwerasd
0a6ef3fda4 wip(terminal): Fast path for scroll regions 2024-03-26 12:07:35 -06:00
Mitchell Hashimoto
41720b3c8d terminal: PageList support initialization of multi-page viewports 2024-03-25 11:06:21 -07:00
Mitchell Hashimoto
705bd21055 terminal: PageList trim blanks erases empty pages
Fixes #1605
2024-03-25 10:18:31 -07:00
Mitchell Hashimoto
9ee0b23ef7 terminal: clear spacer heads on growing cols w/o reflow 2024-03-25 09:42:05 -07:00
Mitchell Hashimoto
1b8dc0c0c1 terminal: add a test for resize less cols across pages with cursor 2024-03-24 19:19:23 -07:00
Mitchell Hashimoto
3d6ae29dc3 terminal: when reflowing, set style to default to prevent integrity fail 2024-03-24 15:22:01 -07:00
Mitchell Hashimoto
f719999950 terminal: add assertion to page integrity that row/col count > 0 2024-03-24 14:46:43 -07:00
Mitchell Hashimoto
225cc642b9 terminal: allow growing beyond max size for active area to fit 2024-03-24 09:45:35 -07:00
Mitchell Hashimoto
6cbe699533 terminal: remove problematic test on 4k pages, still working on it 2024-03-23 21:43:16 -07:00
Mitchell Hashimoto
e4332891ee terminal: avoid memory fragmentation if possible on col grow 2024-03-23 21:37:34 -07:00
Mitchell Hashimoto
f848ed2a63 terminal: handle row wrap integrity issues on reflow 2024-03-22 20:28:22 -07:00
Mitchell Hashimoto
2e9cc75206 terminal: add integrity checks throughout PageList 2024-03-22 20:28:22 -07:00
Mitchell Hashimoto
dfa5b2e6fc terminal: pagelist handle scenario where reflow erases all pages 2024-03-22 20:28:16 -07:00
Mitchell Hashimoto
9d826d8837 terminal: add assertion for trackPin as commented 2024-03-22 20:28:15 -07:00
Mitchell Hashimoto
e64d8f5304 terminal: handles eraseRows that erases our full pagelist 2024-03-22 20:28:15 -07:00
Mitchell Hashimoto
1c57bbabda termio/exec: clear screen should erase rows and shift up 2024-03-22 20:28:12 -07:00
Gregory Anders
d54d7cd581 terminal: set PageList viewport to active area when cloned
As an optimization, the renderer does not attempt to find the cell under
the cursor if the viewport is in the scrollback (i.e. not the active
area). When the renderer clones the screen state it also clones the
PageList, and the cloned PageList has its viewport set to the top of the
scrollback.

This caused the renderer to never attempt to find the cell under the
cursor, which in turn caused cells under the cursor to be improperly
highlighted. Instead, when the PageList is cloned initialize its
viewport to the active area.
2024-03-22 20:28:12 -07:00
Mitchell Hashimoto
3f0607d6c0 terminal: PageList rowIterator respects limit row 2024-03-22 20:28:07 -07:00
Mitchell Hashimoto
07a27072dc inspector: needs to call new PageList.maxSize func 2024-03-22 20:28:07 -07:00
Mitchell Hashimoto
e7a2a9bcd1 terminal: resize no reflow must do cols before rows 2024-03-22 20:28:07 -07:00
Mitchell Hashimoto
7e010caea1 terminal: handle resizing into increased implicit max size 2024-03-22 20:28:06 -07:00