Commit Graph

12787 Commits

Author SHA1 Message Date
Mitchell Hashimoto
2bcc2fa4bd split_tree: resize function 2025-08-11 12:52:16 -07:00
Qwerasd
5bf632e9cc Fix up font raster position + other small fixes (#8206)
I've cleaned up the code we use for scaling and positioning glyphs for
raster, under both CoreText and FreeType. Before we had some
imprecision, and under CoreText we were sometimes stretching glyphs in
unseemly ways. These changes make it so that our constraints can
position and size glyphs *exactly* and we don't have any chopped-off
row/column issues for CoreText. With this, PowerLine Extra symbols now
always align *perfectly* with the cell height:
||Before|After|
|-:|-|-|
|**CoreText**|<img width="105" height="245" alt="image"
src="https://github.com/user-attachments/assets/d3c1b1cb-a798-4e18-a0e0-59551893369c"
/>|<img width="106" height="246" alt="image"
src="https://github.com/user-attachments/assets/dac10c49-9ec1-4f4f-8825-a5e8c2fd3402"
/>|
|**FreeType**|<img width="105" height="245" alt="image"
src="https://github.com/user-attachments/assets/160e1e35-4a3c-42d0-9042-215301e636a1"
/>|<img width="106" height="245" alt="image"
src="https://github.com/user-attachments/assets/89bf1538-7271-4baf-88c0-51ebc4d360df"
/>|

The other changes are mainly just cleanup stuff, though one of the
changes makes it so that we do once again properly apply constraints to
symbols from the dingbats block (it was a regression, noted in #7955,
that we stopped doing that).

### Future work
This has been a problem since we introduced the custom constraints, but
I noticed it while preparing the before/after images: the left-edge PLE
symbols (meant to connect to a full block on the right) expand out to
the *right*, so if they're followed immediately by another character
than they actually get squished and don't match the right-edge symbols:

<img width="75" height="114" alt="image"
src="https://github.com/user-attachments/assets/1420b9a5-9950-4210-9934-8ef7cd7a1e19"
/>

I have a WIP change to move constraint logic to the shapers, and at that
point we can maybe do something to allow the constraint to grow in to
whitespace on the left side instead of on the right side.
2025-08-11 13:44:50 -06:00
Mitchell Hashimoto
a94bd8f5c4 gtk-ng: don't use signals to toggle command palette (#8182) 2025-08-11 12:02:48 -07:00
Jeffrey C. Ollie
5bb88d259c gtk-ng: use WeakRef helper for type safety 2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
2de0c108ba gtk-ng: better handling of weak references
The upstream GIR for g_weak_ref_get is incorrect - it does not allow the
returned value to be NULL. This PR pulls in a new version of our GObject
bindings with that patched and improves the safety of dealing with the
command palette weak reference held by the window.

See ianprime0509/zig-gobject#117
2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
5c088d10a4 gtk-ng: fix memory leaks in command palette 2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
3221421a74 gtk-ng: add TODOs about passing surface that toggled command palette 2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
8af1230228 gtk-ng: don't add extra refs when activating a command in the palette 2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
2a5b7aab86 gtk-ng: don't use signals to toggle command palette 2025-08-11 11:56:08 -07:00
Mitchell Hashimoto
21a9760ff5 apprt/gtk-ng: equalize splits (#8211)
Fixes known issues from #8202. Also brings in the better equalization
logic on macOS from #7710.
2025-08-11 11:39:19 -07:00
Mitchell Hashimoto
9f037a7c23 apprt/gtk-ng: equalize splits 2025-08-11 11:35:13 -07:00
Mitchell Hashimoto
a21b447c75 apprt/gtk-ng: goto_split (including spatial navigation for the first time for our GTK backend) (#8210)
This continues #8202 by fixing two of the known issues: `goto_split` key
binds work and closing a split moves focus to the proper place.

A big improvement in this PR is that for the first time ever in our GTK
backend, the up/down/left/right `goto_split` bindings **use spatial
navigation.** "Spatial navigation" means that the direction to move
focus is done based on the nearest split _visually_ from the current
split, rather than via a tree traversal. We did this on macOS a couple
months ago, with a lot more details there: #7523

Similar to macOS, the spatial navigation is currently based on top-left
corner. Now that our split tree is implemented in Zig though it should
be a lot easier for us to work in the current cursor position as the
reference point.

~~🚧 TODO: Going to add some unit tests for the spatial navigation before
merge.~~
2025-08-11 11:04:06 -07:00
Mitchell Hashimoto
43c3150e81 split_tree: unit tests for spatial nav, fix a bug 2025-08-11 10:59:37 -07:00
Mitchell Hashimoto
5a01877c77 apprt/gtk-ng: spatial navigation 2025-08-11 10:17:13 -07:00
Mitchell Hashimoto
70d48d03a5 apprt/gtk-ng: go to right focus when split closes 2025-08-11 09:51:58 -07:00
Mitchell Hashimoto
5903d7d10f apprt/gtk-ng: hook up goto_split 2025-08-11 09:44:13 -07:00
Mitchell Hashimoto
984435d7ea split_tree: deepest, previous, next traversals 2025-08-11 09:30:59 -07:00
Mitchell Hashimoto
9f959ea876 gtk-ng: fix split-divider-color config (#8209) 2025-08-11 08:38:28 -07:00
Jeffrey C. Ollie
b726183981 gtk-ng: fix split-divider-color config 2025-08-11 10:28:54 -05:00
Mitchell Hashimoto
a9a41aec83 apprt/gtk-ng: create/close split functionality (#8202)
This adds on to our existing foundations from #8165 and adds the ability
to create and close splits. We're still missing split navigation,
resizing via keybindings, etc. And there are a number of known issues
(listed below). But this is a strict improvement from where we're at and
includes a number of important bug fixes to our split tree.

The only nasty thing in this PR is that I learned that GTK _did not
like_ rebuilding our split widget tree on every data model change. I
don't know enough about how all the re-parenting plus size allocation
interactions work together. As a compromise, this PR adds a listener,
waits for our surface tree to "settle" by having all surfaces have no
parents, then schedules a single rebuild after that. This works well,
but results in some noticeable flashing for a frame or so. I think we
can improve this later, it works completely well enough.

Importantly, all of this is Valgrind clean. I long suspected our splits
on legacy are NOT free of leaks, but never proved it, so this makes me
happy.

## Demo



https://github.com/user-attachments/assets/e231d89f-581e-486b-ade0-1d7e6795262e



## Known Issues

I may fix this in this PR, I may follow up.

- [ ] Focus doesn't go to the right place after closing a split
- [x] Divider with a transparent background is transparent
- [x] Close split doesn't show any close confirmation dialog
- Missing features:
  * [ ] Equalize splits
  * [ ] Resize splits keybind (manual mouse action works fine)
  * [ ] Go to split keybind
2025-08-11 08:25:38 -07:00
Mitchell Hashimoto
edd73fa0e4 font/freetype: convert encoding of font names (#8204)
Freetype encodes some font names internally in formats other than UTF-8.
This only affects debug logs but it was annoying me so I fixed it. There
may be other encodings that might need to be dealt with but I took care
of the one that I ran across.
2025-08-10 19:55:35 -07:00
Mitchell Hashimoto
dd983d112d gtk-ng: sync action accelerators for split-tree (#8207) 2025-08-10 19:55:22 -07:00
Jeffrey C. Ollie
aba5a34335 gtk-ng: sync action accelerators for split-tree 2025-08-10 21:31:50 -05:00
Qwerasd
8c7538e996 font/freetype: port improved raster logic from CoreText
We now also have absolute perfect control over the raster position under
FreeType as well. This means that, for example, powerline extended chars
are appropriately clamped to the cell edges at all sizes.

This should be purely an improvement over what we had before, and now it
also matches what we do for CoreText.
2025-08-10 19:59:52 -06:00
Jeffrey C. Ollie
e9e32d71e4 font/freetype: add a test for face name decoding using embedded fonts 2025-08-10 20:10:24 -05:00
Jeffrey C. Ollie
897d70982e font/freetype: convert encoding of font names
Freetype encodes some font names internally in formats other than UTF-8.
This only affects debug logs but it was annoying me so I fixed it. There
may be other encodings that might need to be dealt with but I took care
of the one that I ran across.
2025-08-10 17:29:31 -05:00
Qwerasd
5383cd9c9c font/freetype: pass monochrome load flag when needed
The monochrome hinter is very aggressive but makes text actually look
tolerable when rendered in monochrome. If for some god forsaken reason
we get complaints about this, that someone wanted improperly hinted mono
glyphs, we can introduce additonal configuration; but for now, this is
just a straight improvement.
2025-08-10 16:04:54 -06:00
Qwerasd
20a9a3a8c2 font: use adjusted cell width for recentering again
The old method was nice, but had an issue that's intractible without
significant reworking in how we do shaping: combining glyphs need to
position relative to the glyph they're combining with, but if we re-
center that glyph, it will be off by some amount.
2025-08-10 15:49:54 -06:00
Qwerasd
195cbb6a1c Revert "font/Metrics: remove original_cell_width, no longer needed"
This reverts commit 23cc50b12c.
2025-08-10 15:33:47 -06:00
Qwerasd
f56219be95 font/coretext: fix glyph position/scale code
Apologies to Apple, the previous comments in this section of the code
were not correct-- `shouldSubpixelQuantizeFonts` does pretty much what
the minimal documentation for it says it does, it simply quantizes the
position of the glyph and nothing more. Various bugs when testing while
writing the old code that led me to include those comments made me not
realize that the positioning is actually a lot simpler than it seems.

With this version of the positioning there are never any cut-off rows or
columns of pixels on the edges of anything and everything scales as it
should... I hope. I checked pretty thoroughly this time and I'm like 99%
sure this is correct in all cases.
2025-08-10 15:11:20 -06:00
Qwerasd
ee445d2915 font: compare font Index packed structs directly
Packed structs can be compared directly now, no need to convert them to
an int anymore.
2025-08-10 15:11:20 -06:00
Qwerasd
a8b9dd8dfc renderer: clean up, improve constraintWidth function 2025-08-10 14:54:51 -06:00
Mitchell Hashimoto
ca4e38ff03 apprt/gtk-ng: split close confirmation 2025-08-10 13:35:30 -07:00
Mitchell Hashimoto
441af8389b apprt/gtk-ng: split separator styling 2025-08-10 13:09:06 -07:00
Mitchell Hashimoto
0aaf80402b Update iTerm2 colorschemes (#8195)
Upstream revision:
3cbeca99ef
2025-08-10 12:52:48 -07:00
Mitchell Hashimoto
46560d0018 apprt/gtk-ng: wait for unparent to rebuild split tree 2025-08-10 12:36:28 -07:00
mitchellh
c64701e744 deps: Update iTerm2 color schemes 2025-08-10 00:15:37 +00:00
Mitchell Hashimoto
b1da644b62 apprt/gtk-ng: unnecessary grab focus 2025-08-09 14:48:42 -07:00
Mitchell Hashimoto
e682e99bf5 apprt/gtk-ng: hook up win split actions 2025-08-09 14:36:50 -07:00
Mitchell Hashimoto
aed6a3a343 apprt/gtk-ng: clean up some changed handlers 2025-08-09 14:24:25 -07:00
Mitchell Hashimoto
ec293c1fd0 apprt/gtk-ng: active surface hookups 2025-08-09 13:49:36 -07:00
Mitchell Hashimoto
8232cf33b4 apprt/gtk-ng: surface close in split tree 2025-08-09 12:36:27 -07:00
Mitchell Hashimoto
a28d673467 update supps 2025-08-09 12:24:40 -07:00
Mitchell Hashimoto
9ad92d2c3d apprt/gtk-ng: proper split operations 2025-08-09 12:21:28 -07:00
Mitchell Hashimoto
34be4de018 apprt/gtk-ng: write back split ratio to tree 2025-08-09 12:19:10 -07:00
Mitchell Hashimoto
e396d9d78d apprt/gtk-ng: setup gtk paned listeners to set position 2025-08-09 07:27:11 -07:00
Mitchell Hashimoto
a3c041bcb4 apprt/gtk-ng: keep track of last focused surface 2025-08-08 15:14:41 -07:00
Mitchell Hashimoto
517f17995c apprt/gtk-ng: rebuild the widget tree on an idle callback 2025-08-08 14:38:02 -07:00
Mitchell Hashimoto
fbe28477ff datastruct: fix split tree ascii diagram 2025-08-08 14:22:38 -07:00
Mitchell Hashimoto
75dd8e46b5 datastruct: fix split tree debug log rounding 2025-08-08 14:22:38 -07:00