652 Commits

Author SHA1 Message Date
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
e687cdb82f more TODO 2022-08-06 16:15:52 -07:00
Mitchell Hashimoto
f4e00859ce update TODO with a bunch of select tasks 2022-08-06 16:13:45 -07:00
Mitchell Hashimoto
1da5ca0a7f mouse xpos/ypos can be negative or larger than window size
When calculating the viewport point, we need to consider this. We clamp
the possible values to [0, width/height - 1]. Fixes #1.
2022-08-06 16:05:32 -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
80719d1467 update TODO 2022-08-06 11:19:23 -07:00
Mitchell Hashimoto
8ba9209f64 update mach vendor 2022-08-06 11:10:56 -07:00
Mitchell Hashimoto
ac5b4d8760 update zig 2022-08-05 20:00:56 -07:00
Mitchell Hashimoto
c99a79055c HPA does nothing when status display is active 2022-08-05 19:56:40 -07:00
Mitchell Hashimoto
ce6f022a7e cursor should be a hollow rect on unfocus, regression from e163e4962baad09cd2c36be1529dee4fcf1220b0 2022-08-05 19:26:50 -07:00
Mitchell Hashimoto
dd98768400 note that selectionSlices is tested 2022-08-05 11:40:52 -07:00
Mitchell Hashimoto
263ca66b74 update TODO 2022-08-05 11:39:04 -07:00
Mitchell Hashimoto
2670ae1265 Copy Selection to Clipboard 2022-08-05 11:38:41 -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
Mitchell Hashimoto
ecaca23959 selectionString: test wraparound case, fix bugs 2022-08-05 11:20:53 -07:00
Mitchell Hashimoto
363c51360b selectionString: more accurate buf allocation 2022-08-05 11:08:56 -07:00
Mitchell Hashimoto
25dc292c14 selectionString unwraps properly 2022-08-05 11:04:41 -07:00
Mitchell Hashimoto
dd76fe124d terminal.selectionString to grab the string value of a selection
This isn't done yet, I still have to handle soft-wrapping and test
wrapped cases in the ring buffer.
2022-08-05 10:57:08 -07:00
Mitchell Hashimoto
140f66937d update TODO 2022-08-04 16:58:09 -07:00
Mitchell Hashimoto
0855d391a8 fix selection of a single character
This logic is truly terrible and I know for certain there is an easier
way to calculate this. I also know there are some bugs here. But, the
user-facing result is not bad so let's start with this.
2022-08-04 16:53:10 -07:00
Mitchell Hashimoto
68260cc3d0 fix some selection contains logic on single lines 2022-08-04 14:40:28 -07:00
Mitchell Hashimoto
d0dc69a0a8 color selection! 2022-08-04 14:37:10 -07:00
Mitchell Hashimoto
40161a9eff track mouse state, setup selection state on cursor move with click 2022-08-04 14:21:40 -07:00
Mitchell Hashimoto
f2e9746d2b fix build error 2022-08-04 13:08:51 -07:00
Mitchell Hashimoto
974138378b introducing dedicated point types 2022-08-04 13:04:42 -07:00
Mitchell Hashimoto
8facf9b942 terminal: add Selection struct 2022-08-04 11:44:36 -07:00
Mitchell Hashimoto
bb0b95732e opengl: support extension iteration, list in debug mode 2022-08-04 11:13:56 -07:00
Mitchell Hashimoto
e163e4962b refactor cursor implementation, implement cursor visible (mode 25)
This cleans up a ton of state management around cursor styles,
visibility, blinking, etc. This was long in the tooth and when I was
trying to implement mode 25 I realized it was impossible with the
spaghetti mess I had. This made it really clean.

With this refactor, the Window keeps the "terminal_cursor" field the
proper state, and the render callback properly updates the gpu cells for
the cursor settings.

This also implements mode 25 (cursor visible) which makes neovim not
"flash" when vertically scrolling a vertical split. Neovim does some
cursor stuff but while doing so hides the cursor. This now respects
that.
2022-08-03 21:39:42 -07:00
Mitchell Hashimoto
1680aee880 some logging improvements 2022-08-03 21:13:05 -07:00
Mitchell Hashimoto
b2a9f1f79e update nixpkgs 2022-08-03 09:57:47 -07:00
Mitchell Hashimoto
befeb08b3d add a lot more tracing as I hunt down some performance things 2022-08-03 09:56:32 -07:00
Mitchell Hashimoto
0bc8300e74 remove unused line 2022-08-02 21:45:20 -07:00
Mitchell Hashimoto
f82b8f89e7 releast-fast for dev/install otherwise renders are slow 2022-08-02 21:03:34 -07:00
Mitchell Hashimoto
40cec18943 implement DECSASD by just blackholing the output for now
We don't want to support status lines, and if anything sends us status
line information we don't want it to mess up the main display, so just
drop it.
2022-08-02 11:03:01 -07:00
Mitchell Hashimoto
2b80699179 cursor position absolute needs to ignore all the offset stuff 2022-08-02 10:30:20 -07:00
Mitchell Hashimoto
1fbfc8a664 update Zig nightly 2022-08-02 09:27:05 -07:00