8344 Commits

Author SHA1 Message Date
Mitchell Hashimoto
8f15f1a066 Make Ghostty release channel aware
Ghostty now has a release channel build configuration. Current valid
values are "tip" and "stable" but I imagine more will be added in the
future.

The release channel is inferred whether the version we specify with the
`-Dversion-string` build flag has a prerelease tag or not. If it does,
the release channel is "tip". If it doesn't, the release channel is
"stable".

This also adds a configuration to specify the release channel for
auto-updates for the macOS application.
2024-12-20 14:21:59 -08:00
Mitchell Hashimoto
0abd4ea8a2 ci: release tag workflow
This adds a new workflow for building and releasing _tagged versions_
of Ghostty. The workflow is triggered automatically by new tags in the
format of `vX.Y.Z` but can also be manually triggered by running the
workflow from the GitHub Actions UI.

Release artifacts are uploaded to a completely separate R2 bucket
with its own access policy, retention, API keys, and so on.

There is currently no way to switch between "channels" in the macOS
app. I will follow up with a separate commit to add this feature.
2024-12-20 13:02:05 -08:00
Mitchell Hashimoto
ef56fe8796 WIP CI Release Script (#3034) 2024-12-20 09:58:15 -08:00
Mitchell Hashimoto
486a5a4875 ci: tagged release workflow 2024-12-20 09:52:22 -08:00
Mitchell Hashimoto
330bbd0502 macos: add "Docs" button to the About window 2024-12-20 09:11:04 -08:00
Mitchell Hashimoto
2b352c0349 build: change object storage domain to ghostty.org (#3031)
DNS and TLS are up to date so this should all work. I want to start
rolling this out now so I can phase out the `.dev` before the 1.0
release.
2024-12-20 09:02:39 -08:00
Mitchell Hashimoto
c74966e07e build: change object story domain to ghostty.org 2024-12-20 08:58:46 -08:00
Mitchell Hashimoto
5bb05996eb avoid asserting working directory is absolute (#3028)
`std.fs.accessAbsolute` asserts if the user proposed path is absolute,
which we are seemingly passing as-is with no validating that it is.

When running with safety checks on, passing non-absolute path to
--working-directory will make ghostty crash.

I changed it to use `Dir.access`, which is just `accessAbsolute` without
the check.

This has the side effect of also allowing relative working directory.
2024-12-20 08:25:51 -08:00
Mitchell Hashimoto
0f588d72c7 Change to F3 legacy encoding with modifiers (#3019)
The [fixterms](http://www.leonerd.org.uk/hacks/fixterms/) "Really
Special Keypresses" section suggests using CSI 1 ; Ps R for F3, but this
is also a valid cursor position report. The intention was to make
back-compatible changes, so this is fairly considered a specification
bug.

This changes F3 in legacy mode to send CSI 13 ; Ps ~ instead, this is a
variant listed in fixterms, is what kitty protocol uses, and lacks the
problematic overlap with cursor positions.

The KeyEncoder.zig unit test has been changed accordingly, and all tests
pass on my machine.
2024-12-20 08:25:30 -08:00
Khang Nguyen Duy
239056c90f avoid asserting working directory is absolute
`std.fs.accessAbsolute` asserts if the user proposed path is absolute,
which we are seemingly passing as-is with no validating that it is.

When running with safety checks on, passing non-absolute path to
--working-directory will make ghostty crash.

I changed it to use `Dir.access`, which is just `accessAbsolute` without
the check.

This has the side effect of also allowing relative working directory.
2024-12-20 22:41:28 +07:00
Mitchell Hashimoto
b8ffee7acb webgen: update config to support callouts, emit keybind actions (#3023) 2024-12-19 19:27:55 -08:00
Mitchell Hashimoto
270d454c4e webgen: update config to support callouts, emit keybind actions 2024-12-19 17:15:39 -08:00
Sam Atman
8cadc7030c Change to F3 legacy encoding with modifiers
The [fixterms](http://www.leonerd.org.uk/hacks/fixterms/) "Really
Special Keypresses" section suggests using CSI 1 ; Ps R for F3, but this
is also a valid cursor position report.  The intention was to make back-
compatible changes, so this is fairly considered a specification bug.

This changes F3 in legacy mode to send CSI 13 ; Ps ~ instead, this is a
variant listed in fixterms, is what kitty protocol uses, and lacks the
problematic overlap with cursor positions.

The KeyEncoder.zig unit test has been changed accordingly, and all tests
pass on my machine.
2024-12-19 17:05:29 -05:00
Mitchell Hashimoto
d6e7685816 Docfix: correct comment for modifyOtherKeys sequence (#3018)
The comment in `function_keys.zig` was missing the `>` character for the
sequence. I've confirmed that this was just the comment, Ghostty treats
the original as an SGR sequence, which it is. Conversely, it does treat
`\x1b[>4;2m` as activating modifyOtherKeys.
2024-12-19 14:02:56 -08:00
Sam Atman
d885a266d4 Docfix: correct comment for modifyOtherKeys sequence
The comment in `function_keys.zig` was missing the `>` character for the
sequence.  I've confirmed that this was just the comment, Ghostty treats
the original as an SGR sequence, which it is.  Conversely, it does treat
`\x1b[>4:2m` as activating modifyOtherKeys.
2024-12-19 16:51:28 -05:00
Mitchell Hashimoto
fa3896be03 Fix emoji size and atlas padding (#3016)
Fixes a bug where emojis got smaller when font thicken was enabled
because they were constrained for some reason, here demonstrated by
artificially narrowing the cells with `adjust-cell-width=-45%`:
|`font-thicken`|main|this PR|
|-|-|-|
|`false`|<img width="328" alt="image"
src="https://github.com/user-attachments/assets/c5c25d94-ea73-47e1-80e9-ed3baff76511"
/>|<img width="328" alt="image"
src="https://github.com/user-attachments/assets/f74a35e1-ab7e-470d-b873-f33e63c1c9bb"
/>|
|`true`|<img width="328" alt="image"
src="https://github.com/user-attachments/assets/e7c1e096-4a54-456c-afb0-5adcb94eaf00"
/>|<img width="328" alt="image"
src="https://github.com/user-attachments/assets/80d3d7dd-f572-489a-ab56-d2d5ca9f3508"
/>|

And reworks the CoreText atlas margin/padding calculations to be more
efficient, you can see comparisons with and without thicken both before
and after this change here:
<details>
<summary>Atlas Textures</summary>

### main
|`font-thicken`|gray|color|
|-|-|-|

|`false`|![image](https://github.com/user-attachments/assets/d73a8963-ebfc-44d7-8b57-92db54612336)|![image](https://github.com/user-attachments/assets/4305243b-6459-45aa-bd42-bb263f3b0a9f)|

|`true`|![image](https://github.com/user-attachments/assets/94810d04-ea30-40f9-8d08-07b487b98ad1)|![image](https://github.com/user-attachments/assets/be5f1a2a-7c11-4805-977b-edf8aa7232a1)|

### this PR
|`font-thicken`|gray|color|
|-|-|-|

|`false`|![image](https://github.com/user-attachments/assets/e1debdcb-36bd-44d3-8776-27f4a2285821)|![image](https://github.com/user-attachments/assets/5cdc5eb8-6122-4bf7-8525-93a1b83d2bf0)|

|`true`|![image](https://github.com/user-attachments/assets/423bfb38-2657-4f48-a6fb-77986d049615)|![image](https://github.com/user-attachments/assets/136e970f-25e7-4ec5-8819-5a981381d18f)|
</details>

The atlas padding calculations were also affecting the issue with the
emojis getting smaller when thicken was enabled, because they were given
extra space to account for the thickening but they're bitmap so they
don't get affected by thickening.
2024-12-19 13:31:06 -08:00
Qwerasd
0e21293d43 font(coretext): improve atlas padding calculations
- Simplifies and clarifies the math for how the bounding box for
rendered glyphs is computed
- Reduces margin from 2px between glyphs to 1px by only padding the
bottom and right side of each glyph
- Avoids excessive padding to glyph box when font thicken is enabled or
when using a synthetic bold (it was previously 4x as much padding as
necessary in some cases)
2024-12-19 13:30:52 -08:00
Mitchell Hashimoto
544683bc1e docs: fix referenced toggle window decorations action name (#3017)
I tried adding a key binding as the docs suggested, but it seems like
the referenced action has since been renamed from
`toggle_window_decoration` to `toggle_window_decorations`.

Since I saw questions in other small PRs: I am fine with this being
relicensed under the MIT license.
2024-12-19 13:19:44 -08:00
Niclas van Eyk
7d71eabae8 docs: fix referenced toggle window decorations action name 2024-12-19 22:05:59 +01:00
Qwerasd
4ca6413ec9 renderer: do not constrain color glyphs
There is no reason to and I do not know where this assumption came from.
It's very possible for a colored glyph to (intentionally!) exceed the
cell bounds, and we shouldn't be stopping this...
2024-12-19 11:21:57 -05:00
Mitchell Hashimoto
64af685897 nix: support programs.vim.plugins = [ ghostty.vim ] (#3010)
nixos vim module expects vim plugins to have their code organized as top
level directories. eg: `/ftdetect` rather than
`/share/vim/vimfiles/ftdetect`. Adding a separate output seems like a
convenient way to reference the plugin files in `programs.vim.plugins
...`. Interestingly neovim will find the plugin via directory traversal
making `ghostty.vim` and `ghostty` the same for
`programs.neovim.plugins`

I agree to re-license my commits to MIT
2024-12-19 07:22:23 -08:00
Anund
ac6956f1fe nix: support programs.vim.plugins = [ ghostty.vim ]
nix vim module expects vim plugins to have their code organized as top level
directories. eg: /ftdetect rather than /share/vim/vimfiles/ftdetect. Adding
a separate output seems like a convenient way to reference the plugin
files in `programs.vim.plugins ...`. Interestingly nvim will find the
plugin via nested directories making ghostty.vim and ghostty the same
for `programs.neovim.plugins`
2024-12-19 07:21:54 -08:00
Mitchell Hashimoto
e7ca135af1 Build flags to generate website data, remove old website dir (#3012)
This adds a default-false `-Demit-webdata` build option. This emits some
files we copy over to our website (in the future I'll automate this more
to make a PR or something).

This also removes the old `website/` folder, all of the content was
moved to the website repo which is more updated.
2024-12-18 21:13:56 -08:00
Mitchell Hashimoto
d947fa32ba remove website dir 2024-12-18 21:10:13 -08:00
Mitchell Hashimoto
82c9787fd3 build: generate reference page for config for website 2024-12-18 07:06:35 -08:00
Mitchell Hashimoto
34dca8149b bash: improve clearing of multiline prompts (#3003)
Bash doesn't redraw the leading lines in a multiline prompt so we mark
the last line as a secondary prompt (k=s) to prevent the preceding lines
from being erased by Ghostty after a resize.

Our previously attempt at this (#1973) was flawed. Instead, we now just
re-issue the OSC "133;A" command with a 'k=s' (secondary) kind at the
end of our prompt string.

This isn't a great solution because it stomps on the prompt's "133;B"
command (end of prompt and start of user input), but it's sufficient for
now and only applies in the multiline prompt case.

Going forward, we should revisit our semantic prompt implementation. Our
row-based approach is too limiting; lines can have multiple markers, and
markers should be recorded with their full coordinates so they can form
ranges.

See: https://per.bothner.com/blog/2019/shell-integration-proposal/

Fixes: #1961
2024-12-17 14:17:41 -08:00
Jon Parise
63747d1e22 bash: improve clearing of multiline prompts
Bash doesn't redraw the leading lines in a multiline prompt so we mark
the last line as a secondary prompt (k=s) to prevent the preceding lines
from being erased by Ghostty after a resize.

Our previously attempt at this (#1973) was flawed. Instead, we now just
re-issue the OSC "133;A" command with a 'k=s' (secondary) kind at the
end of our prompt string.

This isn't a great solution because it stomps on the prompt's "133;B"
command (end of prompt and start of user input), but it's sufficient for
now and only applies in the multiline prompt case.

Going forward, we should revisit our semantic prompt implementation. Our
row-based approach is too limiting; lines can have multiple markers, and
markers should be recorded with their full coordinates so they can form
ranges.

See: https://per.bothner.com/blog/2019/shell-integration-proposal/
2024-12-17 16:28:41 -05:00
Mitchell Hashimoto
08f8845dd4 config: disable forced shell integration for -e (#3001)
This prevents forcibly injecting any configured shell integration into
the command's environment. Automatic shell detection is enabled, unless
shell integration has been explicitly disabled.
2024-12-17 12:18:58 -08:00
Jon Parise
a2c546c8d1 config: disable forced shell integration for -e
This prevents forcibly injecting any configured shell integration into
the command's environment. Automatic shell detection is enabled, unless
shell integration has been explicitly disabled.
2024-12-17 12:12:51 -08:00
Mitchell Hashimoto
2725d5ecb3 shell-integration: add bashrc location lookup in Nixos (#2996)
fixes #2979 see
[issue](https://github.com/ghostty-org/ghostty/issues/2979#issuecomment-2547788704)
for discussion

I agree to re-license my commits to MIT
2024-12-17 06:57:32 -08:00
Anund
38b42fc970 shell-integration: add bashrc location lookup in Nixos
fixes #2979
2024-12-17 21:49:15 +11:00
Mitchell Hashimoto
ae6c4c3f0c terminal: handle consecutive .input's in clearPrompt (#2990)
Our semantic prompts are row-based, so the last prompt marker set on a
row "wins". In the case of at least our bash shell integration, this
means that consecutive prompt lines will all be marked as .input (OSC
133;B -- end-of-prompt, start of input).

Previously, clearPrompt() identified the current prompt's "area" by
searching upward from the current row until it encounters a .prompt
marker or some command output. In the bash case, .prompt is never the
dominant ("last") marker, so clearPrompt() would aggressively clear all
immediately preceding consecutive prompts.

With this change, we'll stop searching upwards when we encounter some
command output, a .prompt marker, _or another .input marker_. That last
case prevents clearPrompt() from unintentionally clearing earlier prompt
lines.

There may be improvements we can make to the way that our bash shell
integration emits semantic prompt markers, but I think this logic is
generally sound for all cases, and it specifically improves the current
bash prompt-clearing experience.

---

Before and after, after resizing the terminal window to trigger a
reflow:

<img width="504"
src="https://github.com/user-attachments/assets/91aa652e-e262-445a-8eed-7268c0d66428"
/>
<img width="510"
src="https://github.com/user-attachments/assets/b43e0aa4-0e24-4f4e-9b2c-b6b07c8f8c77"
/>
2024-12-16 21:08:21 -08:00
Mitchell Hashimoto
5e6aea7925 macos: add zsh to the application bundle (#2989)
Fixes #2988
2024-12-16 21:06:59 -08:00
Mitchell Hashimoto
99bdfb09b4 nix: address warning to use toplevel adwaita-icon-theme (#2993)
Preempt `nix develop` breaking when
https://github.com/NixOS/nixpkgs/pull/357818 turns the current warning
message into an error.

I agree to re-license my commits to MIT
2024-12-16 21:06:44 -08:00
Jon Parise
82756f8b4c terminal: handle consecutive .input's in clearPrompt
Our semantic prompts are row-based, so the last prompt marker set on a
row "wins". In the case of at least our bash shell integration, this
means that consecutive prompt lines will all be marked as .input (OSC
133;B -- end-of-prompt, start of input).

Previously, clearPrompt() identified the current prompt's "area" by
searching upward from the current row until it encounters a .prompt
marker or some command output. In the bash case, .prompt is never the
dominant ("last") marker, so clearPrompt() would aggressively clear all
immediately preceding consecutive prompts.

With this change, we'll stop searching upwards when we encounter some
command output, a .prompt marker, _or another .input marker_. That last
case prevents clearPrompt() from unintentionally clearing earlier prompt
lines.

There may be improvements we can make to the way that our bash shell
integration emits semantic prompt markers, but I think this logic is
generally sound for all cases, and it specifically improves the current
bash prompt-clearing experience.
2024-12-16 21:06:15 -08:00
Mitchell Hashimoto
1e352c5cb4 build: allow CLI actions to have enum option values (#2987)
A typo in the fish completions (that was likely copied to the zsh and
bash completions) prevented CLI actions from using enums as option
values because the completions tried to access non-existent fields from
type introspection. This doesn't cause any problems _now_ because no CLI
action uses an enum as an option value. However as soon as you try and
add one the completions fail to compile.

This patch fixes the incorrect field reference. It also adds the ability
to have _optional_ enums as option values.

cc @jparise @anund @anmolw
2024-12-16 21:05:34 -08:00
Anund
c39b60709f nix: address warning to use toplevel adwaita-icon-theme 2024-12-17 14:37:20 +11:00
Jon Parise
717425ca07 macos: add zsh to the application bundle 2024-12-16 19:40:31 -05:00
Jeffrey C. Ollie
7816705898 build: allow CLI actions to have enum option values
A typo in the fish completions (that was likely copied to the zsh and
bash completions) prevented CLI actions from using enums as option
values because the completions tried to access non-existent fields from
type introspection. This doesn't cause any problems _now_ because no CLI
action uses an enum as an option value. However as soon as you try and
add one the completions fail to compile.

This patch fixes the incorrect field reference. It also adds the ability
to have _optional_ enums as option values.
2024-12-16 18:03:32 -06:00
Mitchell Hashimoto
56f285cbc2 Handle fonts with missing or invalid OS/2 tables (#2985)
It turns out this happens more than I thought. Most notably, apple's
fallback font for a bunch of symbols, `Apple Gothic`, has no OS/2 table
🙃. I've gone ahead and fixed it so that both CoreText and FreeType
handle this gracefully.

Speaking of graceful handling, this problem came to attention due to our
very *un*-graceful handling of when a font fails to load due to a
metrics calculation error. It results in a bunch of blanked out text,
very bad, we should fix that.

*At some point I'll try to collect a group of test fonts with all sorts
of weirdnesses to exercise the weird edge cases in our handling.*
2024-12-16 12:43:59 -08:00
Mitchell Hashimoto
2b78ac4382 font: style edits for #2985 2024-12-16 12:30:34 -08:00
Mitchell Hashimoto
bd48dcc748 os: add prependEnv(), like appendEnv() (#2983)
We can use this function in setupXdgDataDirs() to simplify the
XDG_DATA_DIRS environment variable code in a more standardized way.
2024-12-16 12:24:29 -08:00
Qwerasd
a06388869d fix: sCapHeight and sxHeight only exist when OS/2 version >= 2 2024-12-16 15:20:26 -05:00
Qwerasd
13e4861dff font(freetype): tolerate fonts without OS/2 tables
This is more common than anticipated, so proper fallback logic has been
added. Why must fonts be like this? -.-
2024-12-16 14:53:29 -05:00
Qwerasd
5cd214066d font(coretext): tolerate fonts without OS/2 tables
This creates big problems if we don't, since a lot of symbols end up
falling back to Apple Gothic, which doesn't have an OS/2 table.
2024-12-16 14:52:07 -05:00
Mitchell Hashimoto
cf00d14f4d docs: fix typo (#2984)
There was a minor typo in the configuration documentation.
2024-12-16 08:33:11 -08:00
Aaron Bull Schaefer
7999423244 docs: fix typo 2024-12-16 08:00:29 -08:00
Jon Parise
f141f4b2b0 os: add prependEnv(), like appendEnv()
We can use this function in setupXdgDataDirs() to simplify the
XDG_DATA_DIRS environment variable code in a more standardized way.
2024-12-16 10:56:27 -05:00
Mitchell Hashimoto
6a1df9fb8d macos: add bash-completion to the application bundle (#2982) 2024-12-16 07:10:52 -08:00
Jon Parise
f81bb892c0 macos: add bash-completion to the application bundle 2024-12-16 08:38:55 -05:00