78 Commits

Author SHA1 Message Date
Mitchell Hashimoto
1121438d8a maybe clean up resize more cols 2022-09-03 17:50:04 -07:00
Mitchell Hashimoto
d6e243cde1 resize with reflow more cols 2022-09-03 17:28:26 -07:00
Mitchell Hashimoto
2583b8cb65 fix y pos on resize 2022-09-03 12:25:26 -07:00
Mitchell Hashimoto
41f2b756ae fix scrolling and new row calculation 2022-09-03 12:18:45 -07:00
Mitchell Hashimoto
d22a323896 clean up some assertions 2022-09-01 23:25:51 -07:00
Mitchell Hashimoto
8d6e8eb0aa asserts not being optimized away, use comptime gate 2022-09-01 22:21:54 -07:00
Mitchell Hashimoto
57725cf3a4 cache row iterator max value 2022-09-01 22:05:42 -07:00
Mitchell Hashimoto
5aa6d79519 screen: cache history offset
This is a super hot calculation so taking up memory to cache it resulted
in 15m less function calls when catting a 10mb file, and ~5% speedup.
2022-09-01 21:36:59 -07:00
Mitchell Hashimoto
73581eee0b small optimizations 2022-09-01 18:36:27 -07:00
Mitchell Hashimoto
30a14d230e process ASCII events manually to avoid function call overhead 2022-09-01 17:53:40 -07:00
Mitchell Hashimoto
d404be2993 grow our scrollback much faster 2022-09-01 01:15:20 -07:00
Mitchell Hashimoto
dba027d307 resize should maintain minimum of screen rows 2022-09-01 01:09:06 -07:00
Mitchell Hashimoto
77c8ec0a20 the big screen switchover 2022-09-01 00:58:47 -07:00
Mitchell Hashimoto
36140d3ee9 TODO 2022-08-29 20:26:02 -07:00
Mitchell Hashimoto
0505018186 Line segmentation into text runs 2022-08-29 16:39:48 -07:00
Mitchell Hashimoto
65df657b4e make cell attrs bools instead of u1s 2022-08-26 11:09:48 -07:00
Mitchell Hashimoto
46bbab5d10 ignore zero-width characters for now 2022-08-24 13:48:22 -07:00
Mitchell Hashimoto
28072157d5 selection of wide chars and copy/paste works 2022-08-20 17:10:10 -07:00
Mitchell Hashimoto
da79aae0ab terminal: print wide characters 2022-08-20 16:11:48 -07:00
Mitchell Hashimoto
ad1cdbcd59 implement erase display scrollback ("clear" command) 2022-08-09 09:22:34 -07:00
Mitchell Hashimoto
fb5afbedd2 add screen .history tag to fetch scrollback region 2022-08-09 09:18:10 -07:00
Mitchell Hashimoto
38af14ff3a resize alt screen without reflow 2022-08-08 21:14:27 -07:00
Mitchell Hashimoto
f82493cccf when growing cols, adjust viewport and cursor if we shorten 2022-08-08 20:52:36 -07:00
Mitchell Hashimoto
16a5a45293 when growing rows, offset cursor by added rows 2022-08-08 18:14:11 -07:00
Mitchell Hashimoto
d551f1126b when less cols, cursor needs to be in screen space, not viewport 2022-08-08 17:47:16 -07:00
Mitchell Hashimoto
113b5a318b when shrinking rows, clear empty space from the end (see test case) 2022-08-08 17:24:10 -07:00
Mitchell Hashimoto
a2cf116063 fix a crash when reflowing to smaller cols but still buggy 2022-08-08 14:20:52 -07:00
Mitchell Hashimoto
f3d3d255fb handle case where cursor is past where content is on col shrink 2022-08-08 14:08:01 -07:00
Mitchell Hashimoto
9493561159 assertions to save our bacon 2022-08-08 14:03:14 -07:00
Mitchell Hashimoto
e4c8bbd394 reflow cursor when shrinking cols 2022-08-08 14:02:28 -07:00
Mitchell Hashimoto
6fa4cb07c7 more cursor reflow 2022-08-08 13:56:09 -07:00
Mitchell Hashimoto
bfbeceeefa when cols grow, move cursor if it unwraps the line it is on 2022-08-08 13:47:49 -07:00
Mitchell Hashimoto
9ddb19e9b0 replace old resize with new reflow resize 2022-08-08 13:06:01 -07:00
Mitchell Hashimoto
f97b739317 reflow when columns get smaller 2022-08-08 13:04:27 -07:00
Mitchell Hashimoto
8a5dadd995 rowIndex uses tag max so we have max in just one place 2022-08-08 10:38:24 -07:00
Mitchell Hashimoto
57f6986343 rowIterator(.screen) now ignores unused lines, fixes shrinking rows 2022-08-08 10:32:42 -07:00
Mitchell Hashimoto
4ef73efeac resize less rows, but currently not 100% working (see commented tests) 2022-08-08 10:28:11 -07:00
Mitchell Hashimoto
2cf4a265e5 reflow when cols grow 2022-08-08 09:39:55 -07:00
Mitchell Hashimoto
dc351582bc resize increasing column width without reflow 2022-08-07 16:23:23 -07:00
Mitchell Hashimoto
be3a539152 start working on new resize with reflow, can grow rows 2022-08-07 15:52:53 -07:00
Mitchell Hashimoto
039b640f6b Merge branch 'reflow'
This actually doesn't implement reflow but I wanted to merge this
because it has an important refactor and clarity around screen
operations.

It is now clearly defined in the API what portion of the screen you're
accessing (active, viewport, etc.) and the terminal only operates on the
active area (fixing TODO item in diff).

This is all groundwork I found was necessary to even start thinking
about reflow.
2022-08-07 10:47:27 -07:00
Mitchell Hashimoto
2d6d027097 Screen.region to get a region of contiguous memory for a tag 2022-08-07 10:46:35 -07:00
Mitchell Hashimoto
92602dafca rowIterator takes the tag type to iterate over 2022-08-07 10:26:04 -07:00
Mitchell Hashimoto
05e0adaa01 screen operations operate on the active area
This fixes tons of bugs around escape sequences while scrolling that
used to work on the offset from the viewport (which is wrong). This now
calculates the actual active area and does that. This also fixes the
TODO in the diff.
2022-08-07 09:49:54 -07:00
Mitchell Hashimoto
8ea20f9e41 start changing getRow and rowIndex to use tagged indexes
Lots of bugs here, but it MATCHES the bugs!
2022-08-07 09:41:30 -07:00
Mitchell Hashimoto
109e2a67ab selectionString: realloc so free gets the correct length 2022-08-06 15:50:25 -07:00
Mitchell Hashimoto
9d26ab2dc8 memset zero values when resizing a screen
Zig safety checks save us! It was setting undefined values to `0xAA` and
we caught that in a crash. We need to zero this memory.

Practically this happened when `cat`-ing a large file, then attempting
to select and copy any blank trailing space.
2022-08-06 15:44:20 -07:00
Mitchell Hashimoto
dd98768400 note that selectionSlices is tested 2022-08-05 11:40:52 -07:00
Mitchell Hashimoto
d4c4330d4d copy! 2022-08-05 11:37:02 -07:00
Mitchell Hashimoto
abde2b9e18 way easier way to slice to end of storage duh 2022-08-05 11:21:37 -07:00