Commit Graph

8920 Commits

Author SHA1 Message Date
Jon Parise
23f3cd5f10 zsh: improve prompt marking with dynamic themes
Replace the strip-in-preexec / re-add-in-precmd pattern for OSC 133
marks with a save/restore approach. Instead of pattern-matching marks
out of PS1 (which exposes PS1 in intermediate states to other hooks), we
save the original PS1/PS2 before adding marks and then restore them.

This also adds dynamic theme detection: if PS1 changed between cycles
(e.g., a theme rebuilt it), we skip injecting continuation marks into
newlines. This prevents breaking plugins like Pure that use pattern
matching to strip/rebuild the prompt.

Additionally, move _ghostty_precmd to the end of precmd_functions in
_ghostty_deferred_init (instead of substituting in-place) so that the
first prompt is properly marked even when other hooks were appended
after our auto-injection.

There's one scenario that we still don't complete cover:

    precmd_functions+=(_test_overwrite_ps1)
    _test_overwrite_ps1() {
        PS1="test> "
    }

... which results in the first prompt not printing its prompt marks
because _test_overwrite_ps1 becomes the last thing to run, overwriting
our marks, but this will be fixed for subsequent prompts when we move
our handler back to the last index.

Fixes: #11282
2026-03-11 10:07:54 -04:00
Leah Amelia Chen
76e9ee7d37 gtk: fix +new-window --working-directory inferrence. (#11357) 2026-03-11 17:16:06 +08:00
Paul Oliver
82a805296c docs: fix backtick rendering in selection-word-chars default value
The default value contains a literal backtick which broke inline code
rendering on the website. Use double backtick delimiters to properly
contain it.
2026-03-11 21:15:20 +13:00
Jeffrey C. Ollie
ad6d3665c2 gtk: fix +new-window --working-directory inferrence.
If the CLI argument `--working-directory` is not used with
`+new-window`, the current working directory that `ghostty +new-window`
is run from will be appended to the list of configuration data sent
to the main Ghostty process. If `-e` _was_ used on the CLI, the
`--working-directory` that was appended will be interpreted as part of
the command to be executed, likely causing it to fail.

Instead, insert `--working-directory` at the beginning of the list of
configuration that it sent to the main Ghostty process.

Fixes #11356
2026-03-11 02:23:12 -05:00
Steve Hulet
f9862cd4e2 GTK does support scrollbars 2026-03-10 16:14:18 -07:00
Mitchell Hashimoto
04d5efc8eb config: working-directory expands ~/ prefix
Fixes #11336

Introduce a proper WorkingDirectory tagged union type with home, inherit,
and path variants. The field is now an optional (?WorkingDirectory) where
null represents "use platform default" which is resolved during Config.finalize
to .inherit (CLI) or .home (desktop launcher).
2026-03-10 14:33:40 -07:00
Mitchell Hashimoto
a4cc37db72 tests: disable tests that fail if you have locally installed fonts (#11285)
If you have "Noto Sans Tai Tham" and/or "Noto Sans Javanese" installed
locally on Linux, three tests fail. This PR disables those tests until a
more permanent solution can be found.
2026-03-10 11:53:23 -07:00
Jeffrey C. Ollie
c1313294cd add comments about why tests are disabled 2026-03-10 13:29:50 -05:00
Mitchell Hashimoto
53637ec7b2 fix jump_to_prompt forward behavior for multiline prompts
Fixes #11330.

When jumping forward from prompt content, skip prompt continuation rows so a 
multiline prompt is treated as a single prompt block.
2026-03-10 10:47:18 -07:00
Mitchell Hashimoto
aaad43c235 macos: make paste_from_clipboard performable on macos
Fixes #10751
2026-03-10 10:25:14 -07:00
Mitchell Hashimoto
d9039eb85a config: don't double load app support path on macOS
Fixes #11323
2026-03-10 09:23:51 -07:00
Jeffrey C. Ollie
96f9772cd8 tests: disable tests that fail if you have locally installed fonts
If you have "Noto Sans Tai Tham" and/or "Noto Sans Javanese" installed
locally on Linux, three tests fail. This PR disables those tests until a
more permanent solution can be found.
2026-03-09 19:59:21 -05:00
Jeffrey C. Ollie
f8f431ba67 docs: update bell-features docs for macOS
PR #11154 didn't fully update the docs regarding `bell-features=audio`
on macOS.
2026-03-09 16:47:07 -05:00
Mitchell Hashimoto
1e981f858a terminal: fix grapheme edge-wrap hyperlink integrity panic (#11264)
When a grapheme expands to width 2 at the screen edge, this path can
write spacer_head before printWrap() sets row.wrap. With an active
hyperlink, printCell triggers hyperlink bookkeeping and page integrity
checks in that intermediate state, causing UnwrappedSpacerHead.

Mark row.wrap before writing spacer_head in this grapheme-wrap path to
keep the intermediate state valid.
2026-03-09 07:57:42 -07:00
Mitchell Hashimoto
3ba49a784f terminal: fix grapheme edge-wrap hyperlink integrity panic
When a grapheme expands to width 2 at the screen edge, this path can write
spacer_head before printWrap() sets row.wrap. With an active hyperlink,
printCell triggers hyperlink bookkeeping and page integrity checks in that
intermediate state, causing UnwrappedSpacerHead.

Mark row.wrap before writing spacer_head in this grapheme-wrap path to keep
the intermediate state valid.
2026-03-09 07:53:08 -07:00
Mitchell Hashimoto
f4c40c7d53 bash: only define $__ghostty_ps0 when unset (#11258)
This fixes an error if the script was sourced a second time:

    bash: __ghostty_ps0: readonly variable

Because this is a non-exported variable, this would only happen if the
script was sourced multiple times in the same bash session.
2026-03-09 06:40:57 -07:00
Jon Parise
0a659af55f bash: handle existing ; in PROMPT_COMMAND
If an existing PROMPT_COMMAND was a string ending in ; (and maybe some
spaces), we'd add a redundant ;, resulting in a syntax error. Now we
strip any trailing `;[[:space:]]*` characters from the original string
before add ours.
2026-03-09 09:16:29 -04:00
Jon Parise
fd557e8347 bash: only define $__ghostty_ps0 when unset
This fixes an error if the script was sourced a second time:

    bash: __ghostty_ps0: readonly variable

Because this is a non-exported variable, this would only happen if the
script was sourced multiple times in the same bash session.
2026-03-09 08:52:52 -04:00
Mitchell Hashimoto
2d347cad33 GTK: Don't apply unfocused options when searching (#11224)
If you have multiple splits and start searching naturally the focus
transfers over to the search widget which would apply the unfocused
options. This could make it difficult to view your matches from
searching without re-focusing the surface.

This was discovered when I tested
https://github.com/ghostty-org/ghostty/discussions/11218 (which is a
different issue)
2026-03-08 14:03:23 -07:00
rhodes-b
1d59f5dbcd pass search active state through blueprint 2026-03-08 15:57:28 -05:00
Mitchell Hashimoto
2d9dc5cfd1 fix: list-actions outputs without --docs (#11231)
Explicitly flush the buffer once the generation is complete.

Resolves #11221
2026-03-08 07:59:55 -07:00
Damien Mehala
235dde6844 fix: list-actions outputs without --docs
Explicitly flush the buffer once the generation is complete.

Resolves #11221
2026-03-08 15:51:09 +01:00
Mitchell Hashimoto
1d76820937 elvish: improve OSC 133 semantic prompt support (#11222)
Add `aid=$pid` to 133;A and 133;D for nested shell tracking, and fix the
state comparison which was incorrectly using `constantly` (comparing a
string to a function, which always evaluated to true).

OSC 133;B (input start) and 133;P;k=r (right prompt) cannot be reliably
implemented at the script level because Elvish escapes control
characters in prompt function output, and writing directly to /dev/tty
has timing issues because Elvish renders its prompts on a background
thread. Full semantic prompt support requires a native implementation:
https://github.com/elves/elvish/pull/1917

See: #10523
2026-03-08 07:38:51 -07:00
Kat
4d89f1bcae Add es_ES.UTF-8 translation (#10722) 2026-03-08 07:16:14 +00:00
rhodes-b
8635fef7a5 if search is active dont apply unfocused options 2026-03-08 00:24:46 -06:00
Jon Parise
059bd54a5d elvish: improve OSC 133 semantic prompt support
Add `aid=$pid` to 133;A and 133;D for nested shell tracking, and fix the
state comparison which was incorrectly using `constantly` (comparing a
string to a function, which always evaluated to true).

OSC 133;B (input start) and 133;P;k=r (right prompt) cannot be reliably
implemented at the script level because Elvish escapes control
characters in prompt function output, and writing directly to /dev/tty
has timing issues because Elvish renders its prompts on a background
thread. Full semantic prompt support requires a native implementation:
https://github.com/elves/elvish/pull/1917

See: #10523
2026-03-07 20:34:20 -05:00
José Miguel Sarasola
adc6794f3b Add es_ES.UTF-8 translation 2026-03-07 08:41:40 +01:00
Mitchell Hashimoto
25fa58143e macos: add macos-applescript config 2026-03-06 15:04:20 -08:00
Mitchell Hashimoto
04aff46022 macos: add build script, update AGENTS.md, skip UI tests
This is an update to address common agentic issues I run into,
but the `build.nu` script may be generally helpful to people using
the Nix env since `xcodebuild` is broken by default in Nix due to the
compiler/linker overrides Nix shell does.
2026-03-05 19:55:50 -08:00
Jeffrey C. Ollie
b1d3e36e2e windows: add GetComputerNameA so that hostname-related functions work 2026-03-05 10:03:58 -06:00
Jeffrey C. Ollie
d29e1cc137 windows: use explicit error sets to work around lack of file locking 2026-03-05 09:29:04 -06:00
Jeffrey C. Ollie
cccdb0d2ad windows: add trivial implementation of expandHome 2026-03-05 09:28:02 -06:00
Jeffrey C. Ollie
e8aad10326 windows: avoid the use of wcwidth 2026-03-05 09:26:52 -06:00
Jeffrey C. Ollie
acf54a9166 windows: use new callconv convention 2026-03-05 08:26:08 -06:00
Jon Parise
42540f44cd fix: zsh shell integration when sudo and ssh aliases are defined (#11185)
I encountered an issue related to
https://github.com/ghostty-org/ghostty/discussions/8641 and
https://github.com/ghostty-org/ghostty/pull/8647, but in `zsh` instead
of `bash`.

One of my aliases is:

```bash
alias sudo='sudo '
```

Which causes following error when sourcing the zsh shell integrations:

```shell
source /usr/share/ghostty/shell-integration/zsh/ghostty-integration
/usr/share/ghostty/shell-integration/zsh/ghostty-integration:149: defining function based on alias `sudo'
/usr/share/ghostty/shell-integration/zsh/ghostty-integration:233: parse error near `()'
```
2026-03-05 09:08:21 -05:00
Jeffrey C. Ollie
c920a88cdc GTK: add 'move' to the drop target actions
Fixes #11175
2026-03-04 23:31:41 -06:00
Kat
0b802e7c2e i18n: add Vietnamese translation (#8912)
Adds support for the Vietnamese language
2026-03-05 05:30:59 +00:00
Mitchell Hashimoto
fe1e25f7a6 terminal: bound link regex search work with Oniguruma retry limits (#11181)
Fixes #11177

Use per-search Oniguruma match params (retry_limit_in_search) in
StringMap-backed link detection to avoid pathological backtracking hangs
on very long lines.

The units are ticks in the internal loop so its kind of opaque but this
seems to still match some very long URLs. The test case in question was
a 169K character line (which is now rejected).
2026-03-04 21:09:10 -08:00
Mitchell Hashimoto
3dde6e2559 terminal: bound link regex search work with Oniguruma retry limits
Fixes #11177

Use per-search Oniguruma match params (retry_limit_in_search) in
StringMap-backed link detection to avoid pathological backtracking hangs
on very long lines.

The units are ticks in the internal loop so its kind of opaque but
this seems to still match some very long URLs. The test case in question
was a 169K character line (which is now rejected).
2026-03-04 21:02:55 -08:00
Jeffrey C. Ollie
961bf46884 Fix Windows test in src/Command.zig
This was introduced in #10611. This doesn't fix all of the current
Windows build problems, but at least fixes one that I introduced.
2026-03-04 22:35:58 -06:00
Anh Thang
e2a01beca7 Merge branch 'main' into vi_VN 2026-03-05 08:56:57 +07:00
Mitchell Hashimoto
46522a8779 gtk: +new-window now respects --working-directory and -e (#10809)
Fixes: #8862
Fixes: #10716

This adds the machinery to pass configuration settings received over
DBus down to the GObject Surface so that that configuration information
can be used to override some settings from the current "live" config
when creating a new window. Currently it's only possible to override
`--working-directory`, `--command`, and `--title`. `-e` on the `ghostty
+new-window` CLI works as well.

Adding more overridable settings is possible, but being able to fully
override any possible setting would better be served with a major revamp
of how Ghostty handles configs, which is way out of scope at the moment.
2026-03-04 15:09:58 -08:00
Mitchell Hashimoto
58d6021ec4 apprt/gtk: reduce split-tree flicker by reusing leaf widgets
Fixes #8208

Split-tree updates currently clear `tree_bin` and then wait for every surface
to become parentless before rebuilding. That leaves the split area blank for
one or more frames, which is the visible flicker during split create/close/
resize/equalize actions.

Keep the previous widget tree attached until the idle rebuild runs, then
swap in the rebuilt tree in one step. During rebuild, reuse existing
leaf widgets by detaching and reparenting them into the new `GtkPaned` 
hierarchy instead of recreating wrappers for every leaf.

This removes the parent-settling rebuild path and avoids transient blank
frames while preserving debounced rebuild behavior.
2026-03-04 14:56:51 -08:00
Jeffrey C. Ollie
5bc5820f32 gtk: simplify new-window action memory management with an arena 2026-03-04 16:01:12 -06:00
Mitchell Hashimoto
57d877a0d6 Revert "build: link to the system FontConfig by default on non-macOS systems"
This reverts commit 89f9dd7848.
2026-03-04 13:45:41 -08:00
Jeffrey C. Ollie
e27956fdde gtk: remove modifications to the core for overrides 2026-03-04 14:04:07 -06:00
Jeffrey C. Ollie
002a6cc765 gtk: use simpler method for passing overrides around
As discussed in Discord, this commit drops the `ConfigOverride` object
in favor of a simpler method of passing the overrides around. Completely
avoiding changes to the core wasn't possible but it's very minimal now.
2026-03-04 14:04:07 -06:00
Jeffrey C. Ollie
f2ce7c348e gtk: +new-window document --title 2026-03-04 14:04:07 -06:00
Jeffrey C. Ollie
ec0f9ef416 gtk: +new-window now respects --title 2026-03-04 14:04:07 -06:00
Jeffrey C. Ollie
6961c2265e gtk: +new-window now respects --working-directory and -e
Fixes: #8862
Fixes: #10716

This adds the machinery to pass configuration settings received over
DBus down to the GObject Surface so that that configuration information
can be used to override some settings from the current "live" config
when creating a new window. Currently it's only possible to override
`--working-directory` and `--command`. `-e` on the `ghostty +new-window`
CLI works as well.

Adding more overridable settings is possible, but being able to fully
override any possible setting would better be served with a major
revamp of how Ghostty handles configs, which I is way out of scope at
the moment.
2026-03-04 14:04:06 -06:00