Commit Graph

445 Commits

Author SHA1 Message Date
Mitchell Hashimoto
f9a1f526c8 update some copy for the background opacity toggle 2025-12-16 11:40:12 -08:00
himura467
4c6d3f8ed2 macos: add toggle_background_opacity keybind action 2025-12-16 11:32:10 -08:00
Max Bretschneider
4f02e6c096 Wrong action typo fix 2025-12-13 13:45:45 -08:00
Max Bretschneider
afbcfa9e3d Added GOTO_WINDOW to actions 2025-12-13 13:45:44 -08:00
Max Bretschneider
55ae4430b9 Formatting 2025-12-13 13:45:44 -08:00
Max Bretschneider
1c1ef99fb1 Window switching initial 2025-12-13 13:45:44 -08:00
Mitchell Hashimoto
c5d6b951e9 input: shift+backspace in Kitty with only disambiguate should do CSIu
Fixes #9868 (shift+backspace part only)
2025-12-13 07:18:22 -08:00
Matthew Hrehirchuk
12bb2f3f47 feat: add readonly surface mode 2025-12-12 07:24:22 -08:00
Mitchell Hashimoto
6105344c31 macos: add change tab title to right click menu 2025-12-11 16:30:06 -08:00
Mitchell Hashimoto
32033c9e1a core: prompt_tab_title binding and apprt action 2025-12-11 16:03:19 -08:00
Mitchell Hashimoto
3352d5f081 Fix up close right description 2025-12-10 20:57:36 -08:00
Mitchell Hashimoto
cca10f3ca8 Revert GTK UI changes, apple-sdk build stuff 2025-12-10 20:20:37 -08:00
George Papadakis
625d7274bf Add close tabs on the right action 2025-12-10 20:14:27 -08:00
Mitchell Hashimoto
dbfc3eb679 Remove unused imports 2025-11-27 13:37:53 -08:00
Mitchell Hashimoto
4ff0e0c9d2 input: remove the unused end search entry in the palette 2025-11-27 07:21:59 -08:00
Mitchell Hashimoto
c51170da9c add end_search binding 2025-11-26 08:50:06 -08:00
Mitchell Hashimoto
b7e70ce534 apprt: end_search 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
aeaa8d4ead add start_search binding and apprt action 2025-11-26 08:50:03 -08:00
Mitchell Hashimoto
ba7b816af0 core: bindings for navigate_search 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
e49f4a6dbc search binding action starts a search thread on surface 2025-11-24 19:55:27 -08:00
Qwerasd
6d5b4a3426 perf: replace std.debug.assert with inlined version
See doc comment in `quirks.zig` for reasoning
2025-11-17 12:13:56 -07:00
Mitchell Hashimoto
580f9f057b convert t.screen to t.screens.active 2025-11-14 15:40:31 -08:00
Mitchell Hashimoto
901708e8da input: write_*_file actions take an optional format
Fixes #9398
2025-10-31 09:49:59 -07:00
Mitchell Hashimoto
24b9778432 input: add more copy formatted options to the command palette 2025-10-31 08:21:16 -07:00
Mitchell Hashimoto
df037d75a6 copy_to_clipboard format types 2025-10-30 13:40:32 -07:00
Daniel Wennberg
e70ca0b9b5 Don't encode option as alt in modify other keys 2 (#9406)
There have been frequent reports of key encoding issues in vim and tmux
with version 1.2.3 on macOS: #9340, #9361, #9401,
https://discord.com/channels/1005603569187160125/1432413679806320772.

I think I found the culprit: the option modifier is always passed as alt
to the core, regardless of `macos-option-as-alt`. Since #9289, this
means that a key event where option was used (as option) for translation
is encoded as if it also has the alt modifier.

For example, consider the many European keyboard layouts where option+8
sends `[`. If `macos-option-as-alt = true`, Ghostty correctly intercepts
the option and encodes option+8 as alt+8 instead (that is,
`^[[27;3;56~`). But if `macos-option-as-alt = false`, Ghostty first
allows option to be used for translation, obtaining `[`, and then
encodes the key event as alt+[ (that is, `^[[27;3;91~`), rather than
just `[`.

Tweaking the test case from #9289, here's a quick way to see this: set
`macos-option-as-alt = left`, run
```
printf '\033[>4;2m'
cat
```
choose a European keyboard layout (e.g., Norwegian), and hit both
left-option+8 and right-option+8. The former inserts `^[[27;3;56~` in
all well-behaved terminals. The latter inserts `[` in other terminals,
but `^[[27;3;91~` in Ghostty.

Basically, while modify other keys 2 does require encoding consumed
modifiers, the option key is not one of the supported modifiers, and
should not be included (as alt or anything else) when
`macos-option-as-alt = false`.

This PR removes alts that were actually options when using modify other
keys 2.
2025-10-29 20:29:53 -07:00
Mitchell Hashimoto
fb5b8d7968 input: command palette actions must use formatter, not tag (#9325)
Regression from our Zig 0.15 migration.
2025-10-23 12:49:55 -07:00
Mitchell Hashimoto
bdbda2fd83 input: accidentally merged a loud log line 2025-10-22 15:36:21 -07:00
Mitchell Hashimoto
c133fac7e7 lib-vt: wasm convenience functions and a simple example (#9309)
This adds a set of Wasm convenience functions to ease memory management.
These are all prefixed with `ghostty_wasm` and are documented as part of
the standard Doxygen docs.

I also added a very simple single-page HTML example that demonstrates
how to use the Wasm module for key encoding.

This also adds a bunch of safety checks to the C API to verify that
valid values are actually passed to the function. This is an easy to hit
bug.

**AI disclosure:** The example is AI-written with Amp. I read through
all the code and understand it but I can't claim there isn't a better
way, I'm far from a JS expert. It is simple and works currently though.
Happy to see improvements if anyone wants to contribute.
2025-10-22 14:25:52 -07:00
Mitchell Hashimoto
da165fc3cf input: modify other keys 2 should use all mods, ignore consumed mods (#9289)
Fixes #8900

Our xterm modify other keys state 2 encoding was stripped consumed mods
from the keyboard event. This doesn't match xterm or other popular
terminal emulators (but most importantly: xterm). Use the full set of
mods and add a test to verify this.

Reproduction:

```
printf '\033[>4;2m' 
cat
```

Then press `ctrl+shift+h` and compare across terminals.
2025-10-20 14:41:35 -07:00
Matthew Hrehirchuk
2696d50ca4 feat: added mouse-reporting / toggle-mouse-reporting (#9282)
Closes #8430

A few questions:
* Should I set a default keybind for `toggle-mouse-reporting`? The issue
mentioned one, it's currently unset.
* Am I handling the `toggle-mouse-reporting` action properly in
`performAction` (gtk) / `action` (macos)?

Copilot was used to understand the codebase, but code was authored
manually.
2025-10-19 20:45:37 -07:00
Mitchell Hashimoto
c86266cd90 input: scroll_to_row action 2025-10-16 09:11:03 -07:00
Mitchell Hashimoto
61fe78c1d3 lib-vt: expose key encoding as a C API 2025-10-05 14:40:20 -07:00
Mitchell Hashimoto
44496df899 input: use std.Io.Writer for key encoder, new API, expose via libghostty
This modernizes `KeyEncoder` to a new `std.Io.Writer`-based API.
Additionally, instead of a single struct, it is now an `encode` function
that takes a series of more focused options. This is more idiomatic Zig
while also making it easier to expose via libghostty-vt.

libghostty-vt also gains access to key encoding APIs.
2025-10-04 20:19:39 -07:00
Mitchell Hashimoto
d4dcecb071 Move paste encoding to the input package, test, optimize away one alloc
This moves our paste logic to `src/input` in preparation for exposing
this as part of libghostty-vt. This yields an immediate benefit of
unit tests for paste encoding. 

Additionally, we were able to remove one allocation on every unbracketed
paste path unless the input specifically contains a newline. Unlikely to
be noticable, but nice.

NOTE: This also includes one change in behavior: we no longer encode
`\r\n` and a single `\r`, but as a duplicate `\r\r`. This matches xterm
behavior and I don't think will result in any issues since duplicate
carriage returns should do nothing in well-behaved terminals.
2025-10-04 14:05:32 -07:00
Mitchell Hashimoto
cb295b84a0 Zig 0.15: zig build test 2025-10-03 07:10:43 -07:00
Jacob Sandlund
4f2d80b08f Merge remote-tracking branch 'upstream/main' into jacob/uucode 2025-09-25 08:43:18 -04:00
Jeffrey C. Ollie
5265414a36 config: smarter parsing in autoParseStruct
Fixes #8849

Previously, the `parseAutoStruct` function that was used to parse
generic structs for the config simply split the input value on commas
without taking into account quoting or escapes. This led to problems
because it was impossible to include a comma in the value of config
entries that were parsed by `parseAutoStruct`. This is particularly
problematic because `ghostty +show-config --default` would produce
output like the following:

```
command-palette-entry = title:Focus Split: Next,description:Focus the next split, if any.,action:goto_split:next
```

Because the `description` contains a comma, Ghostty is unable to
parse this correctly. The value would be split into four parts:

```
title:Focus Split: Next
description:Focus the next split
 if any.
action:goto_split:next
```

Instead of three parts:

```
title:Focus Split: Next
description:Focus the next split, if any.
action:goto_split:next
```

Because `parseAutoStruct` simply looked for commas to split on, no
amount of quoting or escaping would allow that to be parsed correctly.

This is fixed by (1) introducing a parser that will split the input
to `parseAutoStruct` into fields while taking into account quotes and
escaping. And (2) changing the `ghostty +show-config` output to put the
values in `command-palette-entry` into quotes so that Ghostty can parse
it's own output.

`parseAutoStruct` will also now parse double quoted values as a Zig
string literal. This makes it easier to embed control codes, whitespace,
and commas in values.
2025-09-23 20:44:49 -05:00
Jacob Sandlund
cf3b514efc pr feedback: get, remove todos for case_folding_simple 2025-09-19 01:24:13 -04:00
Jacob Sandlund
69594119c3 fix up diff from benchmarks, and add tests against ziglyph 2025-09-18 11:46:05 -04:00
Jacob Sandlund
3275903611 update uucode and cleanups 2025-09-18 09:26:09 -04:00
Jacob Sandlund
ae21e2c8cf Merge remote-tracking branch 'upstream/main' into jacob/uucode 2025-09-17 02:34:06 -04:00
Mitchell Hashimoto
f7e622e8af config: fix binding parsing to allow values containing =
Fixes #8667

The binding `a=text:=` didn't parse properly.

This is a band-aid solution. It works and we have test coverage for it
thankfully. Longer term we should move the parser to a fully
state-machine based parser that parses the trigger first then the
action, to avoid these kind of things.
2025-09-16 13:53:16 -07:00
dmunozv04
c6143a1539 Docs: add undo-timeout configuration setting name 2025-09-15 22:55:01 +02:00
Jacob Sandlund
f86a3a9b50 Merge remote-tracking branch 'upstream/main' into jacob/uucode 2025-09-06 14:31:41 -04:00
Leah Amelia Chen
93debc439c gtk: the Future is Now 2025-09-05 10:10:52 +02:00
Leah Amelia Chen
ac52af27d3 gtk: nuke the legacy apprt from orbit
We don't really have any large outstanding regressions on -ng to warrant
keeping this alive anymore. ¡Adiós!
2025-09-05 00:21:41 +02:00
Jacob Sandlund
c67f51f3ee Merge remote-tracking branch 'upstream/main' into jacob/uucode 2025-09-01 01:34:03 -04:00
Jeffrey C. Ollie
6f630a27be gtk-ng: implement close_tab:other keybind 2025-08-26 12:22:45 -05:00
Jeffrey C. Ollie
52a25e9c69 parameterize close_tab
- Add mode (`this`/`other`) parameter to `close_tab` keybind/apprt action.
- Keybinds will default to `this` if not specified, eliminating backward
  compatibility issues (`keybind=x=close_tab` === `keybind=x=close_tab:this`).
- Remove `close_other_tabs` keybind and apprt action.
2025-08-25 11:00:26 -05:00