8486 Commits

Author SHA1 Message Date
azhn
29f040716c Fix cimgui version string to match pkg/cimgui/vendor/ and the upstream version 2025-01-03 17:47:50 +11:00
Mitchell Hashimoto
9c15d8de35 ci: keep old source tarballs as well 2024-12-29 13:24:28 -08:00
Anthony
8335a31e45 Use github yaml substitution for yaml element 2024-12-28 04:04:55 +11:00
Anthony
e07f813a50 Merge branch 'main' of github.com:ghostty-org/ghostty 2024-12-28 03:33:45 +11:00
Anthony
b9128aded5 CI: Update release-tag.yml to include the version in the source archive name and prefix 2024-12-28 03:33:12 +11:00
Mitchell Hashimoto
a8e5eef11c Fix certain paths in the docs containing spaces when the shouldn't (#3276)
This addresses issue #3275
2024-12-26 19:59:38 -08:00
Joris Guex
73367a55f6 Fix docs formatting 2024-12-27 11:45:42 +08:00
Mitchell Hashimoto
b5f70b834b updated logic for grouping actions (#3262)
Update logic for generating `webgen_actions`. 

Before the change, the following grouping was produced:
```md
## `copy_to_clipboard`
Copy and paste.


## `paste_from_clipboard`
## `paste_from_selection`
## `increase_font_size`
Increase/decrease the font size by a certain amount.
```

After the change, the following grouping is being produced
```md
## `copy_to_clipboard`
## `paste_from_clipboard`
## `paste_from_selection`
Copy and paste.

## `increase_font_size`
## `decrease_font_size`
Increase/decrease the font size by a certain amount.
```

Please note that this is my first time ever writing zig, so forgive me
violating zig best practices and feel free to make suggestions

Successor of [this](https://github.com/ghostty-org/website/pull/147) pr
in the website repo
2024-12-26 19:41:26 -08:00
Mitchell Hashimoto
869987277c Update help comment for backslash (#3173)
Such a little commit, but I banged my head on it for a few minutes!
2024-12-26 19:33:08 -08:00
Mitchell Hashimoto
aef90ffff1 Use doc comments for focus-follows-mouse (#3259)
Fixes the description of `focus-follows-mouse` not showing up in the
autogenerated docs and the website
2024-12-26 19:31:30 -08:00
Mitchell Hashimoto
729b7ba7ed Re-add nix-compat flake input (#3217)
Its entry in flake.lock is required for shell.nix to operate as it's
been written. Hash values are restored to where they last existed.

Fixes #3216.
2024-12-26 19:27:58 -08:00
Felix Salcher
5411c001c8 added doc comment 2024-12-27 04:23:17 +01:00
Felix Salcher
ebfa606c67 updated logic for grouping actions 2024-12-27 04:14:17 +01:00
Anmol Wadhwani
7aced21a8e Use doc comments for focus-follows-mouse 2024-12-27 08:29:35 +05:30
Chip Bilbrey
cb5fbc1041 Re-add nix-compat flake input
Its entry in flake.lock is required for shell.nix to operate as it's
been written. Hash values are restored to where they last existed.
2024-12-26 16:21:18 -08:00
Mitchell Hashimoto
35b9ceee21 up the version to 1.0.1 everywhere for dev 2024-12-26 15:21:50 -08:00
Lucas Crownover
6217dbebcf Update help comment for backslash 2024-12-26 14:58:43 -08:00
Mitchell Hashimoto
4b4d4062df build.zig: v1.0.0 v1.0.0 2024-12-26 12:00:22 -08:00
Mitchell Hashimoto
68f09eb60d set version metadata to 1.0.0 2024-12-26 11:49:31 -08:00
Mitchell Hashimoto
e56a9e3721 Create LICENSE 2024-12-26 11:45:54 -08:00
Mitchell Hashimoto
307726f1b1 macos: send a cursor position event on mouseEnter (#3133)
Fixes #3117

On mouseExit we sent a cursor position event with (-1, -1). Negative
values are meant to indicate that the cursor is not on the surface. The
magnitude of the values are irrelevant. However, we never reset the
cursor position on mouseEnter.

This has the effect of the previous cursor position being stuck outside
the viewport which makes certain things such as `button` mouse reporting
not report until the mouse is moved.

This commit sends the correct cursor position event on mouseEnter.
2024-12-26 07:25:47 -08:00
Mitchell Hashimoto
4e47b2ab6b macos: send a cursor position event on mouseEnter
Fixes #3117

On mouseExit we sent a cursor position event with (-1, -1). Negative
values are meant to indicate that the cursor is not on the surface. The
magnitude of the values are irrelevant. However, we never reset the
cursor position on mouseEnter.

This has the effect of the previous cursor position being stuck outside
the viewport which makes certain things such as `button` mouse reporting
not report until the mouse is moved.

This commit sends the correct cursor position event on mouseEnter.
2024-12-26 07:16:43 -08:00
Mitchell Hashimoto
cd2e2b801a Screen.cursorScrollAboveRotate memory corruption fix (#3129)
Extracted from #3110

Initial fix is relatively basic, and catching it with a test only
required a little bit of extra scrutiny of the cursor state after one of
the tests that we already had.

However, the fix revealed faulty dirty tracking logic throughout the
`cursorScrollAbove` function (and therefore bad results that were being
tested for when they should not have been). I've ended up clarifying
things, fixing the asserted dirty states in all the `cursorScrollAbove`
tests, and then finally implementing another very trivial fix that
catches the mistake.

Fixing the dirty tracking is really just an exercise in correctness
though, since when the scroll happens it inherently invalidates the
viewport, and therefore will trigger a full rebuild in the renderer...
unless, I guess, another operation is performed that cancels things out
and results in the viewport pin being in the same place as the previous
render, but that seems an exceptionally difficult scenario to make
happen on purpose much less accidentally.

This PR is almost entirely changes to comments and tests, there are only
2 lines of real code it changes, the one added to the start of
`cursorScrollAbove` and the one modified at the start of
`cursorScrollAboveRotate`. I believe these changes are entirely safe. (I
wonder if they might have a bad effect on our `vtebench` scrolling
performance though...)
2024-12-26 06:30:27 -08:00
Mitchell Hashimoto
ed8b960ade Screen.cursorAbsolute memory corruption fix (#3127)
Extracted from #3110

A simple fix, with a unit test that covers the issue. This could cause
memory corruption and crashes in fairly realistic scenarios, since it
can occur whenever `cursorAbsolute` is used to move to a page that
happens to be at capacity for some form of managed memory and the cursor
is carrying some managed memory with it (style, hyperlink, etc.).

I really wish Zig had affine types so we could make `cursorChangePin`
"consume" its argument so it can't be accidentally used afterwards... I
think I'll audit the rest of the codebase anywhere we use
`cursorChangePin` to make sure we don't have similar problems.
2024-12-26 06:30:05 -08:00
Mitchell Hashimoto
c53532ddb7 apprt/gtk: handle nullable event from event controller (#3131)
gtk_event_controller_get_current_event() is documented to possibly
return NULL.

Fixes: #3088
Link:
https://docs.gtk.org/gtk4/method.EventController.get_current_event.html
2024-12-25 22:26:24 -08:00
Tristan Partin
a38acbc11c apprt/gtk: handle nullable event from event controller
gtk_event_controller_get_current_event() is documented to possibly
return NULL.

Fixes: https://github.com/ghostty-org/ghostty/issues/2022
Fixes: https://github.com/ghostty-org/ghostty/issues/3088
Link: https://docs.gtk.org/gtk4/method.EventController.get_current_event.html
Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-25 23:38:18 -06:00
Qwerasd
d030155c81 fix: unconditionally mark cursor row dirty in cursorScrollAbove
explained in comment
2024-12-25 21:15:58 -05:00
Qwerasd
67f51dcffd test: correct scroll above dirty assertions
Accounts for improved behavior due to prior memory corruption fix for
`cursorScrollAboveRotate` and reveals a new problem in a different
`cursorScrollAbove` sub-function.
2024-12-25 21:14:18 -05:00
Qwerasd
b68c161d98 improve comments
The new diagrams are different due to changes that have happened since
they were last generated.
2024-12-25 21:00:36 -05:00
Qwerasd
6d034d04a0 fix: memory corruption in Screen.cursorScrollAboveRotate
Unless it's guaranteed that the new pin is in the same page as the old
one, `cursor.page_pin` should only be updated through `cursorChangePin`,
not directly.
2024-12-25 20:09:20 -05:00
Qwerasd
a387e680ed test: add additional checks to scroll above cross-page test
Reveals a memory corruption issue caused by the direct assignment of
`cursor.page_pin` instead of using the `cursorChangePin` method.
2024-12-25 20:08:05 -05:00
Qwerasd
8f0dcb9d91 fix: memory corruption in Screen.cursorAbsolute
We call `cursorChangePin` which may invalidate the provided pin if it
needs to adjust the page capacity, and as such we should consider the
pin we pass in to it invalid afterwards, and access it through cursor
instead.
2024-12-25 19:04:35 -05:00
Qwerasd
b89e87c80d test: add failing test for Screen.cursorAbsolute memory corruption 2024-12-25 19:04:35 -05:00
Jan200101
7027147c76 terminal: support progress for ConEmu pause and error state 2024-12-25 14:38:34 -08:00
Mitchell Hashimoto
3356ce18d1 fix: correct handling of CTC and DECST8C (#3121)
Cursor Tab Control (CTC) `CSI <n> W` has a default value of 0, which is
the same as setting a tab stop at the current cursor position. Set Tab
at every 8th Column (DECST8C) `CSI ? 5 W` is a DEC private sequence that
resets the tab stops to every 8th column.

Reference: https://vt100.net/docs/vt510-rm/DECST8C.html
Reference:
https://wezfurlong.org/ecma48/07-control.html?highlight=ctc#7210-ctc---cursor-tabulation-control
Reference:
https://gitlab.gnome.org/GNOME/vte/-/blob/master/src/parser-seq.py#L596-L601
Fixes: https://github.com/ghostty-org/ghostty/issues/3120
2024-12-25 14:36:22 -08:00
Mitchell Hashimoto
eacba35d19 terminal: parse ConEmu progress OSC 9 (#3124)
Fixes #3119
Supersedes #3099 

ConEmu and iTerm2 both use OSC 9 to implement different things. iTerm2
uses it to implement desktop notifications, while ConEmu uses it to
implement various OS commands.

Ghostty has supported iTerm2 OSC 9 for a while, but it didn't (and
doesn't) support ConEmu OSC 9. This means that if a program tries to
send a ConEmu OSC 9 to Ghostty, it will turn into a desktop
notification.

This commit adds parsing for ConEmu OSC 9 progress reports. This means
that these specific syntaxes can never be desktop notifications, but
they're quite strange to be desktop notifications anyway so this should
be an okay tradeoff.

This doesn't actually _do anything with the progress reports_, it just
parses them so that they don't turn into desktop notifications.

cc @Jan200101
2024-12-25 13:35:13 -08:00
Jan200101
c3bf7246f6 terminal: parse ConEmu progress OSC 9
Fixes #3119

ConEmu and iTerm2 both use OSC 9 to implement different things. iTerm2
uses it to implement desktop notifications, while ConEmu uses it to
implement various OS commands.

Ghostty has supported iTerm2 OSC 9 for a while, but it didn't (and
doesn't) support ConEmu OSC 9. This means that if a program tries to
send a ConEmu OSC 9 to Ghostty, it will turn into a desktop notification.

This commit adds parsing for ConEmu OSC 9 progress reports. This means
that these specific syntaxes can never be desktop notifications, but
they're quite strange to be desktop notifications anyway so this should
be an okay tradeoff.

This doesn't actually _do anything with the progress reports_, it just
parses them so that they don't turn into desktop notifications.
2024-12-25 13:23:21 -08:00
Ayman Bagabas
48368471a7 fix: correct handling of CTC and DECST8C
Cursor Tab Control (CTC) `CSI <n> W` has a default value of 0, which is
the same as setting a tab stop at the current cursor position. Set Tab
at every 8th Column (DECST8C) `CSI ? 5 W` is a DEC private sequence that
resets the tab stops to every 8th column.

Reference: https://vt100.net/docs/vt510-rm/DECST8C.html
Reference: https://wezfurlong.org/ecma48/07-control.html?highlight=ctc#7210-ctc---cursor-tabulation-control
Reference: https://gitlab.gnome.org/GNOME/vte/-/blob/master/src/parser-seq.py#L596-L601
Fixes: https://github.com/ghostty-org/ghostty/issues/3120
2024-12-25 23:40:04 +03:00
Mitchell Hashimoto
fa6b01c8f5 config: use escaped encoding for macOS cmd+left/right (#3116)
Fixes #3114

I forgot that the format gets parsed as a Zig string so putting it in
already parsed made `+list-keybinds` incorrect. It worked either way but
this fixes the `+list-keybinds` CLI action.
2024-12-25 07:16:16 -08:00
Mitchell Hashimoto
c3e493f247 config: use escaped encoding for macOS cmd+left/right
Fixes #3114

I forgot that the format gets parsed as a Zig string so putting it in
already parsed made `+list-keybinds` incorrect. It worked either way but
this fixes the `+list-keybinds` CLI action.
2024-12-25 07:06:06 -08:00
Mitchell Hashimoto
8de95f6e8d optimize Style.eql using PackedStyle (#3113)
A follow-up on #3103, the `Style.eql` function can also benefit from
`PackedStyle`.

Using the same DFZ benchmark,
New: 795 FPS
Old (fddedd7c): 765 FPS

FPS is a bit different due to differing background system loads, but the
increase in FPS is consistent across benchmarks.
2024-12-25 06:36:49 -08:00
David Rubin
8efa638110 optimize Style.eql using PackedStyle 2024-12-25 00:20:06 -08:00
Mitchell Hashimoto
fddedd7c01 feat: add support for middle position quick terminal (#3100)
# Description

This commit introduces the ability to launch the quick terminal in the
middle position.

![Screen Recording 2024-12-24 at 14 59
46](https://github.com/user-attachments/assets/6c733caf-34c7-4e80-ba16-24b41f98d2f0)

## Note to reviewer
- The quick terminal is currently centered. Should we consider adding a
top offset to better align with the screenshot in [the issue](#2494 )?
Should it be configurable?
- On large monitors, half the visible frame might be excessively large.
To mitigate, I am planning to implement #2384 but we should probably
agree on a good default maximum width/height in middle position.
- I also figured out, reloading the configuration does not update the
quick terminal configuration. That is also an issue I will try to fix.

Resolves #2494

I agree to relicense my commit to MIT.
2024-12-24 20:25:38 -08:00
Mitchell Hashimoto
c8d72abb12 config: revert cmd/alt+left/right to legacy encoding on macOS by default (#3107)
Fixes #3106
Related to #2838
Discussion in #2363

This breaks fixterms encodings for these specific keys so that shells
and other programs that rely on the legacy encoding for these keys will
work by default.

This only does this for macOS because for whatever reason during the
large beta period, only macOS users found this as lacking.

If users want to restore fixterms behaviors, they can rebind these keys
as `unbind`.
2024-12-24 20:10:48 -08:00
Damien Mehala
44459e93d1 code review 2024-12-25 00:07:12 +01:00
Mitchell Hashimoto
5bb2c62fba config: revert cmd/alt+left/right to legacy encoding on macOS by default
Fixes #3106
Related to #2838
Discussion in #2363

This breaks fixterms encodings for these specific keys so that shells
and other programs that rely on the legacy encoding for these keys will
work by default.

This only does this for macOS because for whatever reason during the
large beta period, only macOS users found this as lacking.

If users want to restore fixterms behaviors, they can rebind these keys
as `unbind`.
2024-12-24 14:48:08 -08:00
Mitchell Hashimoto
44e1c0f397 macos: Make "Settings…" menu item open config file in Application Sup… (#2895)
…port

...unless ~/.config/ghostty/config already exists, then that is opened.
(Or whatever $XDG_CONFIG_HOME points to.)

If both files exists, ghostty reads first the one in
~/.config/ghostty/config and then the one in Application Support, and
merges the settings. In that case, the menu item opens the file at
~/.config.

Fixes #2890.
2024-12-24 12:11:52 -08:00
Mitchell Hashimoto
846660f087 optimize Style hashing to be single-shot (#3103)
The idea is to serialize `Style` into a packed format as quickly as
possible.
Following an SOA pattern here yields the best result.

Using the Doom-Fire benchmark, 
New: 780FPS
Old (f46a6769): 627FPS

Memory usage isn't affected as the layout changes cancel each other out.
2024-12-24 12:11:34 -08:00
Mitchell Hashimoto
d7542ec504 terminal: address typos in style struct 2024-12-24 12:08:05 -08:00
David Rubin
5052be3efe add some comments 2024-12-24 10:07:58 -08:00