5828 Commits

Author SHA1 Message Date
Kat
e8054c41f5 Use source in the example for sourcing Zsh shell integration 2024-12-28 09:01:41 +00:00
Koray08
0160f8a0d9 Add 'command delete' default to macOS 2024-12-28 10:41:52 +02:00
Mitchell Hashimoto
6cbd69da78 Update docs generators to include proper edit on github links (#3651)
Ref: https://github.com/ghostty-org/website/pull/197

The "Edit on Github" links currently on
[ghostty.org](https://ghostty.org/) link to the downstream MDX files.
This has lead to multiple folks editing the downstream MDX files.

Preview:

https://website-git-edit-on-github-link-override-ghostty.vercel.app/docs/config/reference#auto-update-channel
2024-12-27 21:05:27 -08:00
Brandon Romano
16e4529f69 Update docs generators to include proper edit on github links
Ref: https://github.com/ghostty-org/website/pull/197
2024-12-27 20:59:50 -08:00
Rohit-Bevinahally
2555f09d88 modify cmd+9 behaviour 2024-12-27 20:14:28 -08:00
Mitchell Hashimoto
bee2188014 apprt/gtk: color popovers when window-theme=ghostty (#3569)
This looks better than the regular dark color. It also happens to match
what Ptyxis does. It does not support non-libadwaita builds.

Before:

![image](https://github.com/user-attachments/assets/8c400bdf-05b3-4629-925d-fd8ce9554ae7)

After:

![image](https://github.com/user-attachments/assets/d958eb6a-102d-4d91-970b-fcaca7f2386c)

It will look even better whenever we fix the separator colors 😄
2024-12-27 13:39:41 -08:00
Tristan Partin
bf46ab8d2d apprt/gtk: color popovers when window-theme=ghostty
This looks better than the regular dark color. It also happens to match
what Ptyxis does. It does not support non-libadwaita builds.

Signed-off-by: Tristan Partin <tristan@partin.io>
2024-12-27 14:32:02 -06:00
Mitchell Hashimoto
590c2929e7 Fix typo in config docs (#3564)
This was originally fixed in ghostty-org/website#152, but was
accidentally reverted in
[ghostty-org/website#99795d7882a5ee47437454c7c106c2874e0406dc](99795d7882).

P.S., you might want an PR template to discourage folks from making
unsolicited PRs like this :)
P.P.S., you can write issue templates as yaml files to stop folks from
ignoring them (required fields)
2024-12-27 12:08:44 -08:00
Eli
27a5a50aa0 fix: typo
Original fix: ghostty-org/website#152
Reverted: ghostty-org/website#99795d7882a5ee47437454c7c106c2874e0406dc.
2024-12-27 14:02:25 -06:00
Mitchell Hashimoto
c8dca6c9a8 Fix building with -Dflatpak=true (#3440)
While running a Ghostty instance built with this option currently
crashes under Flatpak, at least it ensures we're able to build it again.
2024-12-27 11:58:39 -08:00
Mitchell Hashimoto
571d9b015d Fix zsh shell integration docs (#3332)
- There is no need to quote variables in zsh.
- The shell integration file is not executable; we should `source` it
instead.
2024-12-27 11:54:07 -08:00
Mitchell Hashimoto
66dbc48e6b fix elvish integration: remove erroneous call to "type" (#3386)
An exception is raised from the elvish integration module when
`TERMINFO` is set:

```
Exception: exec: "type": executable file not found in $PATH
  ghostty-integration.elv:120:60-71:   if (and (not $no-sudo) (not-eq "" $E:TERMINFO) (eq file (type -t sudo))) {
  ghostty-integration.elv:38:1-123:1:
```

`type` is a builtin in bash and [in
fish](https://fishshell.com/docs/current/cmds/type.html) but it does not
exist in elvish. I suspect it is here as an accidental copy/paste from
the ghostty [fish
integration](https://github.com/ghostty-org/ghostty/blob/main/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish#L71).

Maybe we can use the elvish
[`has-external`](https://elv.sh/ref/builtin.html#has-external) function
instead (or we could remove that check altogether).

Edit: I think this is in a merge-able state (and it would fix that
error!), but I have just converted this PR to a draft since I can see
other problems with the script. I'll give it a more thorough treatment
later and amend this PR (or also happy to merge this and do other fixes
in separate PRs).
2024-12-27 11:53:54 -08:00
Mitchell Hashimoto
1622263519 cli(list_themes): ignore .DS_Store (#3425)
macOS will create `.DS_Store` files in any directory it opens in Finder.
The `+list_themes` command would then list this file as a theme, and
attempt to preview it. `.DS_Store` is a binary file, and is silently
failing in the theme preview...I am on Linux and when I put a small
binary file in my user themes directory, I get a segfault. There is
something about the specific contents in `.DS_Store` that does not cause
this segfault, but lets us silently fail. We should investigate this
further - the issue is in `Config.loadFile` I believe.

In either case, we need to ignore `.DS_Store` so that it is not listed
as a theme.
2024-12-27 11:53:04 -08:00
Mitchell Hashimoto
93b6bfdefe Update doc inform toggle_quick_terminal macOS only (#3464)
From the 'CONTRIBUTING.md':
"Pull requests should be associated with a previously accepted issue. If
you open a pull request for something that wasn't previously discussed,
it may be closed or remain stale for an indefinite period of time. I'm
not saying it will never be accepted, but the odds are stacked against
you."

I understand this, and I make a PR without an issue because I feel like
this is actually binary.

On discord I've been informed the quick terminal is macOS only, and in
the documentation I don't think this is expressed, please correct me if
wrong and close this.

If it's correct and the documentation should contain it, then here's my
PR adding that information on the bottom of the section.
If the location of the added information does not fit the style
guidelines I can change it.
2024-12-27 11:52:32 -08:00
xaviduds
96753aa7e0 Update doc inform toggle_quick_terminal macOS only 2024-12-27 11:52:20 -08:00
Mitchell Hashimoto
09470ede55 gtk: equalize on double clicking the split handle (#3557) 2024-12-27 11:50:15 -08:00
LuK1337
66ed72f486 gtk: equalize on double clicking the split handle 2024-12-27 20:45:13 +01:00
Qwerasd
322f166ca5 coretext: exclude bitmap fonts from discovery
We do not currently support bitmap fonts in a real capacity, and they
often are missing some tables which we currently rely on for metrics,
and we don't handle the metrics calculations failing gracefully right
now.
2024-12-27 14:06:46 -05:00
Yorick Peterse
50f7632d81 Fix building with -Dflatpak=true
While running a Ghostty instance built with this option currently
crashes under Flatpak, at least it ensures we're able to build it again.
2024-12-27 16:27:19 +01:00
Tim Culverhouse
c2792a1811 cli(list_themes): ignore .DS_Store
macOS will create `.DS_Store` files in any directory it opens in Finder.
The `+list_themes` command would then list this file as a theme, and
attempt to preview it. `.DS_Store` is a binary file, and is silently
failing in the theme preview...I am on Linux and when I put a small
binary file in my user themes directory, I get a segfault. There is
something about the specific contents in `.DS_Store` that does not cause
this segfault, but lets us silently fail. We should investigate this
further - the issue is in `Config.loadFile` I believe.

In either case, we need to ignore `.DS_Store` so that it is not listed
as a theme.

Fixes: #3378
2024-12-27 09:00:08 -06:00
Daniel Patterson
a4daabb28a Rename goto_split top/bottom directions to up/down. 2024-12-27 14:56:48 +00:00
Ankur Kothari
c320635c29 fix use of bash builtin in elvish integration
`type` is a bash builtin and should not be used in elvish.

```
Exception: exec: "type": executable file not found in $PATH
  ghostty-integration.elv:120:60-71:   if (and (not $no-sudo) (not-eq "" $E:TERMINFO) (eq file (type -t sudo))) {
  ghostty-integration.elv:38:1-123:1:
```

We can use the elvish `has-external` function instead.
2024-12-27 23:10:06 +11:00
XiaoYan Li
a295c5e884 Fix zsh shell integration docs
- There is no need to quote variables in zsh.
- The shell integration file is not executable; we should `source` it instead.
2024-12-27 15:56:14 +08:00
Anund
600eea08cd testing: point Command.zig at ~more universal external binaries
The `Command.zig` tests reach outside the local source tree and look for
files on the host os machine. This introduces some portability issues
for the tests.

The nix build sandbox doesn't include `/usr/bin/env` making it error out
when `zig build test` runs `Command.zig` tests as part of a `nix build`.
Current ci and local development relies on `nix develop` sharing a host os
file system that includes `/usr/bin/env`.

Turns out `/tmp` and `/bin/sh` are available in the build sandbox in
nix so we swap these in to enable nixpkg builds to include testing
ghostty as part of any update cycle.
2024-12-27 17:07:24 +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
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
Gregory Anders
eef9664ef8 renderer: track if fg/bg/cursor color is explicitly set by an OSC
The renderer must track if the foreground, background, and cursor colors
are explicitly set by an OSC so that changes are not overridden when the
config file is reloaded.
2024-12-26 20:18:45 -06:00
Anund
b2cb80dfbb testing: move cleanup of execveZ into the test code 2024-12-27 11:08:45 +11:00
Anund
184db2654c testing: handle execveZ failing during test execution
Duplicating a test process via fork does unexepected things.
zig build test will hang
A test binary created via -Demit-test-exe will run 2 copies of the test suite
2024-12-27 11:08:44 +11:00
Lucas Crownover
6217dbebcf Update help comment for backslash 2024-12-26 14:58: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
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