9140 Commits

Author SHA1 Message Date
Mitchell Hashimoto
fdd330d22d apprt/gtk: stylistic changes 2024-12-15 14:01:10 -08:00
Tristan Partin
98380f3c42 apprt/gtk: abstract AdwHeaderBar and GtkHeaderBar
This will make further changes a little bit more readable.

Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-15 14:01:10 -08:00
Mitchell Hashimoto
09b7c7b617 apprt/gtk: add gtk-tabs-location=hidden (#2729)
This is only supported on libadwaita. Instead of the normal tab overview
button, we will use an AdwTabButton[0].

Link:
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.6/class.TabButton.html
[0]
2024-12-15 13:54:30 -08:00
Mitchell Hashimoto
fc6357ac70 apprt/gtk: slight style feedback 2024-12-15 13:54:06 -08:00
Anund
79d2f508a9 bash: support short form boolean options 2024-12-16 08:23:28 +11:00
Anund
f1728f594a bash: remove quoted completions while sorting possible portability issue 2024-12-16 08:22:42 +11:00
Jeffrey C. Ollie
d0677928af font: add sprites for the separated block quadrants
Unicode 16 added "Separated Block Quadrants" from CP 0x0x1CC21 through 0x1CC2F:

𜰡 𜰢 𜰣 𜰤 𜰥 𜰦 𜰧 𜰨 𜰩 𜰪 𜰫 𜰬 𜰭 𜰮 𜰯

To test, use the following command:

```
printf "\U0001CC21\U0001CC22\U0001CC23\U0001CC24\U0001CC25\U0001CC26\U0001CC27\U0001CC28\U0001CC29\U0001CC2A\U0001CC2B\U0001CC2C\U0001CC2D\U0001CC2E\U0001CC2F\n"
```
2024-12-15 14:33:09 -06:00
Mitchell Hashimoto
ceef2900e2 bash: re-enable automatic bash shell detection (#2966)
Bash shell detection was originally disabled in #1823 due to problems
with /bin/bash on macOS.

Apple distributes their own patched version of Bash 3.2 on macOS that
disables the POSIX-style $ENV-based startup path:


e5397a7e74/bash-3.2/shell.c (L1112-L1114)

This means we're unable to perform our automatic shell integration
sequence in this specific environment. Standard Bash 3.2 works fine.

Knowing this, we can re-enable bash shell detection by default unless
we're running "/bin/bash" on Darwin. We can safely assume that's the
unsupported Bash executable because /bin is non-writable on modern macOS
installations due to System Integrity Protection.

macOS users can either manually source our shell integration script
(which otherwise works fine with Apple's Bash) or install a standard
version of Bash from Homebrew or elsewhere.
2024-12-15 07:13:53 -08:00
Anund
ea181579df bash: add _files and _dirs to correctly add spaces to only the final result 2024-12-16 01:32:51 +11:00
Anund
361967f721 bash: formatting changes, change to reference binary name via variable 2024-12-16 01:32:50 +11:00
Anund
c02789205e bash: fix incorrect completion for '--key ' 2024-12-16 01:32:46 +11:00
deftdawg
9117842a45 Merge branch 'ghostty-org:main' into alt-keybindings-copy-and-paste 2024-12-15 00:21:20 -05:00
Mitchell Hashimoto
de3674ff39 Update iTerm2 colorschemes (#2972)
Upstream revision:
5fd82e34a3
2024-12-14 17:11:31 -08:00
mitchellh
854ec586f9 deps: Update iTerm2 color schemes 2024-12-15 01:05:52 +00:00
Jon Parise
a0ce70651a bash: re-enable automatic bash shell detection
Bash shell detection was originally disabled in #1823 due to problems
with /bin/bash on macOS.

Apple distributes their own patched version of Bash 3.2 on macOS that
disables the POSIX-style $ENV-based startup path:

e5397a7e74/bash-3.2/shell.c (L1112-L1114)

This means we're unable to perform our automatic shell integration
sequence in this specific environment. Standard Bash 3.2 works fine.

Knowing this, we can re-enable bash shell detection by default unless
we're running "/bin/bash" on Darwin. We can safely assume that's the
unsupported Bash executable because /bin is non-writable on modern macOS
installations due to System Integrity Protection.

macOS users can either manually source our shell integration script
(which otherwise works fine with Apple's Bash) or install a standard
version of Bash from Homebrew or elsewhere.
2024-12-14 17:31:28 -05:00
Tristan Partin
06ba06cfd0 apprt/gtk: unify tooltip text with AdwTabButton
AdwTabButton uses "View Open Tabs."

Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-14 12:40:11 -06:00
Tristan Partin
73bb2bb9bc apprt/gtk: add gtk-tabs-location=hidden
This is only supported on libadwaita. Instead of the normal tab overview
button, we will use an AdwTabButton[0].

Link: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.6/class.TabButton.html [0]
Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-14 12:40:11 -06:00
Mitchell Hashimoto
fba10a442c Fish/zsh completion simple fixes (#2964)
Adds -e handling to both completions. Updates eval overhead on fish to
avoid similar adjustments made in #2962. Fixes improperly escaped sed
expression for generating theme names in completions.

I agree to re-license these commits as MIT
2024-12-14 08:23:40 -08:00
Anund
fddc880941 bash: add bash completion generation
closes #2053
2024-12-15 02:37:12 +11:00
Anund
5195042f96 zsh: add -e completion, fix incorrectly copied sed expression
skip +version +help to keep completions the same across bash/zsh/fish
2024-12-15 02:06:16 +11:00
Anund
71aec52b8c fish: raise eval quota inline with other completions, add -e 2024-12-15 01:28:52 +11:00
Qwerasd
60b554c0a8 build: increase zsh completion gen eval branch quota
Exceeded due to a larger config struct
2024-12-13 15:44:01 -05:00
Qwerasd
d48c6fc885 config: add adjust keys for new font metrics 2024-12-13 15:36:13 -05:00
Mitchell Hashimoto
a73cb2b258 font: fix sign of usWinDescent interpretation (#2960)
comment explains

In the future we should probably find or craft example fonts that have
weird metrics in their tables and make unit tests for them.
2024-12-13 10:50:37 -08:00
Qwerasd
4573890f22 font: fix sign of usWinDescent interpretation 2024-12-13 13:14:49 -05:00
Mitchell Hashimoto
b2a9af7359 Unified metrics fixes (#2959)
Fix a couple issues that arose from the unified metrics stuff.

One is that cursor sprites weren't rendering wide for wide characters-
I've extracted cursor rendering to a separate file so it's not mixed in
with Box any more, it should be correct now.

The other issue is that I was assuming most fonts had sane `sTypo*`
metrics for vertical sizing, but I was very wrong, so I've replaced the
extraction of the vertical metrics with code that performs a similar
process to what FreeType does to determine a font's ascent. This fixes
the problem, here's an example with a font with the issue:
|Before|After|
|-|-|
|<img width="752" alt="image"
src="https://github.com/user-attachments/assets/71752b0c-35d7-4c35-b5bb-301149d906a7"
/>|<img width="752" alt="image"
src="https://github.com/user-attachments/assets/2f9ae8ce-9f3a-4701-b0fe-e032da7e2246"
/>|
2024-12-13 10:08:25 -08:00
Qwerasd
8a5d484729 font: more robust extraction of vertical metrics from tables
Previously always assuming the typo metrics were good caused some fonts
to have abnormally short cell heights.
2024-12-13 13:00:03 -05:00
Qwerasd
13dd4bd897 font/sprite: separate out cursor rendering from Box
(Fixes width handling when hovering wide chars)
2024-12-13 12:16:15 -05:00
Mitchell Hashimoto
0d0d06e50a Add delay before a title change to avoid flicker on macOS (#2929)
Implements #2503 for macOS

This PR introduces a delay (75ms) before a title change to avoid the
flicker caused by fast running commands.

It adds a timer to `titleDidChange` in the
[BaseTerminalController](https://github.com/ghostty-org/ghostty/blob/main/macos/Sources/Features/Terminal/BaseTerminalController.swift)
to delay the window title update.

However, this alone didn't work with `macos-titlebar-style = tabs` as
the main window title is hidden and toolbar tab titles are set
separately in
[TerminalController](https://github.com/ghostty-org/ghostty/blob/main/macos/Sources/Features/Terminal/TerminalController.swift).
I have added another timer in there to avoid flicker for tab titles.

I also tried @qwerasd205's suggested approach by putting the timer in
the
[SurfaceView](https://github.com/ghostty-org/ghostty/blob/main/macos/Sources/Ghostty/SurfaceView_AppKit.swift)
and setting it inside `setTitle` in
[Ghostty.App](https://github.com/ghostty-org/ghostty/blob/main/macos/Sources/Ghostty/Ghostty.App.swift),
and that also works. Maybe this a better approach as it avoids having
two timers?

There is still a flicker from the title changing from default "👻
Ghostty" to the current directory when opening new tabs but neither
approach fixes that. Not too sure how to prevent that.

Before:


https://github.com/user-attachments/assets/bd87ff36-9888-4d01-904a-2e80b8edea18

After:


https://github.com/user-attachments/assets/dae8eb24-8ae0-4412-ab84-bf313aac8063
2024-12-13 06:30:36 -08:00
Mitchell Hashimoto
68bf5a9492 ci: on release, only upload appcast after binaries 2024-12-12 21:12:35 -08:00
Mitchell Hashimoto
fa72646e96 Unified font metrics (#2948)
This is a big one, I kind of over scoped a touch. I don't have it in me
to do a clean-up pass on this code before PR-ing it, so apologies for
any weirdness; I'll happily resolve any feedback, but trying to review
my own code right now is not something my brain wants to do.

#### Summary
- Font metric calculations reworked to be based primarily on data from
font tables, and now the majority of the logic is shared between
CoreText and FreeType, and we have more control over the specifics.
- Sprite font metrics for the position and thickness of underlines,
strikethroughs, and overlines are now separate, as well as box drawing
thickness, allowing for individual adjustments.
- Minimums are applied to font metrics to avoid *completely* broken
results from fonts with degenerate values in them.

### Unified Metrics Calculations
I added a solid foundation for parsing as many SFNT font tables as we
need, and added parsing for `head`, `hhea` (unused), `post`, and `OS/2`.
I didn't make a strong effort to account for variable fonts, so if a
variable font changes vertical metrics significantly it could cause
issues -- luckily, width, which is the most likely metric to change, is
not a problem, since we get the width by having our backends measure the
advances for us, which does account for variations correctly.

### Separated Sprite Metrics
I reworked the sprite renderer to just get a copy of the metrics that it
can use directly, instead of being given its own metrics (width, height,
thickness) -- so that the different thickness metrics can be used for
their intended purposes, and so that offsets for "unadjusted" characters
can be handled in the Box renderer itself.

### Minimums
Prevent degenerate fonts and bad `adjust` configs from creating, e.g.
zero-thickness underlines by applying a minimum to certain fields after
calculating metrics and after applying modifiers.

### Misc.
Fixed `init` for CoreText faces selecting the first predefined instance
of a variable font rather than the default.
2024-12-12 21:02:09 -08:00
Mitchell Hashimoto
b7dc767237 face: add more RLS types and explicit error sets 2024-12-12 19:47:58 -08:00
Qwerasd
586a7e517e font(freetype): actually take max ascii width instead of first 2024-12-12 21:30:01 -05:00
Qwerasd
f54379aacd font(Box/cursors): properly account for un-adjusted height 2024-12-12 21:04:30 -05:00
Qwerasd
0a29b78a6c clarify naming convention 2024-12-12 20:38:26 -05:00
Mitchell Hashimoto
ddb51122d0 Preserve ZSH options in the shell integration (#2950)
This fixes the #2847. There were two problems:
1. Documentation made it easy to use the bash example as a template for
calling other integrations
2. f the ZSH integration script is called the same way as for bash, it
would clobber the options

This PR fixes both. Now the ZSH script can be simply called with
`source`.

Here is why the options were clobbered, and how the method of calling
affected it:

The `-L` flag (local scope) ensures that the emulation mode only applies
to the current function scope. When the function ends, the shell reverts
to its previous state. When called outside of a function, the flags
persist even after the script execution ends.

The recommended way of calling the ZSH integration included `autoload
-Uz` that created a function with the integration script as its body.
When called directly, the assumptions about being in the function body
broke.

This PR moves a lot of code into a function, so it's best to review with
whitespace ignored in the diff.
2024-12-12 16:44:56 -08:00
Mitchell Hashimoto
4fdf5eb12b macos: move title setting into a function to better encapsulate 2024-12-12 16:43:22 -08:00
Mitchell Hashimoto
6f01dbf792 Select boundary dollar (#2938)
Proposed fix for #2933
2024-12-12 16:30:19 -08:00
Mitchell Hashimoto
e5e090deaf test: big perf win by pausing integ checks while growing pages (#2956)
In multiple tests we create 1 or more pages by growing them 1 row at a
time, which results in an integrity check of the page for each row grown
which is just... horrible. By simply pausing integrity checks while
growing these pages (since growing them is not the point of the test) we
MASSIVELY speed up all of these tests.

Also reduced grapheme bytes during testing and made the Terminal "glitch
text" test actually assert what it intends to achieve, rather than just
blindly assuming 100 copies of the text will be the right amount -- this
lets us stop a lot earlier, making it take practically no time.
2024-12-12 16:12:22 -08:00
Mitchell Hashimoto
b47f36c444 Fix typo in config documentation (#2936)
them -> theme
2024-12-12 16:09:31 -08:00
Borys Lykah
2d26965f39 Fix style warning 2024-12-12 16:54:01 -07:00
Qwerasd
10abeba414 test: big perf win by pausing integ checks while growing pages
In multiple tests we create 1 or more pages by growing them 1 row at a
time, which results in an integrity check of the page for each row grown
which is just... horrible. By simply pausing integrity checks while
growing these pages (since growing them is not the point of the test) we
MASSIVELY speed up all of these tests.

Also reduced grapheme bytes during testing and made the Terminal "glitch
text" test actually assert what it intends to achieve, rather than just
blindly assuming 100 copies of the text will be the right amount -- this
lets us stop a lot earlier, making it take practically no time.
2024-12-12 16:58:48 -05:00
Mitchell Hashimoto
3ea3155100 Update iTerm2 colorschemes (#2955)
Upstream revision:
d1484b69fc
2024-12-12 13:48:03 -08:00
Mitchell Hashimoto
10bbb7511b ci: colorscheme update should verify nix hash and build 2024-12-12 13:47:53 -08:00
mitchellh
c4029015b9 deps: Update iTerm2 color schemes 2024-12-12 21:45:11 +00:00
Mitchell Hashimoto
5a085267ca prettier 2024-12-12 13:42:49 -08:00
Mitchell Hashimoto
9b4e3622aa ci: iTerm2 job should run on Namespace and use cache 2024-12-12 13:41:52 -08:00
Mitchell Hashimoto
674e2980e2 Add weekly iterm2-colorschemes update workflow (#2940)
I've added a weekly github actions workflow that automatically creates a
PR to update the iTerm2 colorschemes dependency and the zig cache hash
alongside it. I'm using a third-party action to create the pull request
such that it won't create another PR if a pending one exists already,
and will force-push to the PR branch (iterm2_colors_action) instead.

I noticed that the other workflows made use of namespace runners and
caching along with a cachix action, but I haven't included them here
yet. I could update the workflow to match those if you'd like.
2024-12-12 13:39:16 -08:00
Mitchell Hashimoto
c1a6319490 unicode: emoji modifier requires emoji modifier base preceding to not… (#2954)
… break

Fixes #2941

This fixes the rendering of the text below. For those that can't see it,
it is the following in UTF-32: `0x22 0x1F3FF 0x22`.

```
"🏿"
```

`0x1F3FF` is the Fitzpatrick modifier for dark skin tone. It has the
Unicode property `Emoji_Modifier`. Emoji modifiers are defined in UTS
#51 and are only valid based on ED-13:

```
emoji_modifier_sequence := emoji_modifier_base emoji_modifier
emoji_modifier_base := \p{Emoji_Modifier_Base}
emoji_modifier := \p{Emoji_Modifier}
```

Additional quote from UTS #51:

> To have an effect on an emoji, an emoji modifier must immediately
follow
> that base emoji character. Emoji presentation selectors are neither
needed
> nor recommended for emoji characters when they are followed by emoji
> modifiers, and should not be used in newly generated emoji modifier
> sequences; the emoji modifier automatically implies the emoji
presentation
> style.

Our precomputed grapheme break table was mistakingly not following this
rule. This commit fixes that by adding a check for that every
`Emoji_Modifier` character must be preceded by an `Emoji_Modifier_Base`.
This only has a cost during compilation (table generation). The runtime
cost is identical; the table size didn't increase since we had leftover
bits we could use.
2024-12-12 13:05:59 -08:00
Mitchell Hashimoto
2315906ff5 fix(kittygfx): load & display command shouldn't respond to i=0,I=0 (#2953)
Load and display (`T`) was responding even with implicit IDs, because
the display was achieved with an early return in the transmit function
that bypassed the logic to silence implicit ID responses- by making it
not an early return we fix this.
2024-12-12 12:55:53 -08:00