Commit Graph

8006 Commits

Author SHA1 Message Date
Mitchell Hashimoto
b084889782 config: cmd+f on macos start_search default 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
20758fb80e Misc search fixes (#9711)
- ScreenSearch has to restart on resize. We don't have any good way to
handle reflow since our search results are unpinned. We can look into
this later but this fixes correctness.
- PageList now tracks serial number by node that monotonically increases
on any alloc or reuse. Our screen search uses this to prune invalid
history results.
2025-11-26 08:49:54 -08:00
Mitchell Hashimoto
9b7753a36f terminal: ScreenSearch prunes by min serial 2025-11-26 08:46:26 -08:00
Mitchell Hashimoto
30f189d774 terminal: PageList has page_serial_min 2025-11-26 08:41:26 -08:00
Mitchell Hashimoto
e549af76fe terminal: flattened highlights contain serial numbers for nodes 2025-11-26 08:36:29 -08:00
Mitchell Hashimoto
1786022ac3 terminal: ScreenSearch restarts on resize 2025-11-26 08:31:09 -08:00
Mitchell Hashimoto
8d11335ee4 terminal: PageList stores serial number for page nodes 2025-11-26 08:15:41 -08:00
Mitchell Hashimoto
d9529947a4 apprt/gtk: (clipboard) fix GTK internal paste of UTF-8 content (#9710)
When pasting text in GTK, the current version properly prioritizes
text/plain;charset=utf-8 when the content is offered by another
application, but when pasting from ghostty to itself the mime type
selection algorithm prefers the offer order and matches `text/plain`,
which then converts non-ASCII UTF-8 into a bunch of escaped hex
characters (e.g. 日本語 becomes \E6\97\A5\E6\9C\AC\E8\AA\9E)

This is being discussed on the GTK side[1], but until everyone gets an
updated GTK it cannot hurt to offer the UTF-8 variant first (and one of
the GTK dev claims it actually is a bug not to do it, but the wayland
spec is not clear about it, so other clients could behave similarly)

Link: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/9189 [1]
Fixes #9682
2025-11-26 06:19:18 -08:00
Dominique Martinet
53d0abf4dc apprt/gtk: (clipboard) fix GTK internal paste of UTF-8 content
When pasting text in GTK, the current version properly prioritizes
text/plain;charset=utf-8 when the content is offered by another
application, but when pasting from ghostty to itself the mime type
selection algorithm prefers the offer order and matches `text/plain`,
which then converts non-ASCII UTF-8 into a bunch of escaped hex
characters (e.g. 日本語 becomes \E6\97\A5\E6\9C\AC\E8\AA\9E)

This is being discussed on the GTK side[1], but until everyone gets an
updated GTK it cannot hurt to offer the UTF-8 variant first (and one of
the GTK dev claims it actually is a bug not to do it, but the wayland
spec is not clear about it, so other clients could behave similarly)

Link: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/9189 [1]
Fixes #9682
2025-11-26 12:59:59 +00:00
Mitchell Hashimoto
7fba2da404 better default search match color 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
d0334b7ab6 search: scroll to selected search match 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
ba7b816af0 core: bindings for navigate_search 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
880db9fdd0 renderer: hook up search selection match highlighting 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
333dd08c97 search: thread dispatches selection notices, messages 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
a2a771bb6f search: previous match 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
c38e098c4c search: fixup selected search when reloading active area 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
23479fe409 search: select next search match 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
08f57ab6d6 search: prune invalid history entries on feed 2025-11-25 11:05:38 -08:00
Jacob Sandlund
807febcb5e benchmarks: align read_buf to cache line 2025-11-25 09:07:21 -05:00
Daniel Wennberg
d31be89b16 fix(renderer): load linearized fg color for cursor cell 2025-11-24 21:04:54 -08:00
Mitchell Hashimoto
bb21c3d6b3 search: case-insesitive (ascii) search 2025-11-24 20:25:26 -08:00
Mitchell Hashimoto
de16e4a92b config: add selection-foreground/background 2025-11-24 20:16:01 -08:00
Mitchell Hashimoto
a4e40c7567 set proper dirty state to redo viewport search 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
06981175af renderer: reset search dirty state after processing 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
d0e3a79a74 reset search on needle change or quit 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
dd9ed531ad render viewport matches 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
6c8ffb5fc1 renderer: receive message with viewport match selections
Doesn't draw yet
2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
061d157b50 terminal: search should use active area dirty tracking 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
72921741e8 terminal: search.viewport supports dirty tracking for more efficient 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
e49f4a6dbc search binding action starts a search thread on surface 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
6623c20c2d terminal: switch search to use flattened highlights 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
05d6315e82 terminal: add a SlidingWindow2 that uses highlights 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
ec5bdf1a5a terminal: highlights 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
56b69ff0fd datastruct: make CircBuf use the assumeCapacity pattern 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
878ccd3f34 renderer: use proper cell style for cursor-color/text
Regression from render state work.
2025-11-24 19:52:21 -08:00
Qwerasd
6d65abc489 fix(pkg/freetype): fully correct load flags
These now properly match the FreeType API- compared directly in the unit
tests against the values provided by the FreeType header itself.

This was ridiculously wrong before, like... wow.
2025-11-24 17:57:02 -07:00
Mitchell Hashimoto
b5dfe5dbfe Add GHOSTTY_QUICK_TERMINAL for quick terminal detection (#9673)
## Summary

Adds a new environment variable `GHOSTTY_QUICK_TERMINAL=1` that is set
when a terminal surface is launched as a quick terminal. This allows
shell configurations to conditionally adjust behavior based on whether
the terminal is a quick terminal.

Closes #3985

<img width="1430" height="228" alt="CleanShot 2025-11-23 at 12 39 27
png"
src="https://github.com/user-attachments/assets/1085c19b-9d58-4603-a03d-662bfde47095"
/>

## Motivation

Quick terminals are designed as ephemeral, singleton windows for quick
commands. Many users (especially tmux users) have shell configurations
that automatically attach to or start tmux sessions on terminal launch.
This automatic behavior conflicts with the quick terminal use case.

Example from the issue:
```zsh
# Users want to skip this in quick terminals
if [[ -z "$TMUX" ]]; then
  tmux attach || tmux new
fi

With this PR, users can now detect quick terminals and adjust their shell behavior:
if [[ -z "$TMUX" ]] && [[ -z "$GHOSTTY_QUICK_TERMINAL" ]]; then
  tmux attach || tmux new
fi
```

## Implementation

- macOS: Added GHOSTTY_QUICK_TERMINAL=1 to SurfaceConfiguration
environment variables in QuickTerminalController.swift:345-351
- Linux/GTK: Added environment variable check in
src/apprt/gtk/class/surface.zig:1469-1472 within defaultTermioEnv()

 The environment variable is automatically inherited by split surfaces.

## Note on Scripting API

I'm aware that @rhodes-b mentioned this functionality was planned for
the scripting API (issue #3985). However, I believe this simpler
environment variable approach provides immediate value for tmux users
and shell configuration use cases, while the scripting API can later
provide more comprehensive surface introspection capabilities.

## AI Assistance Disclosure

This PR was written with Claude Code assistance. The Linux/GTK
implementation was fully AI-generated. I implemented the mac version
myself after Claude Code helped me understand the codebase architecture
and locate the appropriate files.
2025-11-24 08:21:21 -08:00
Jacob Sandlund
8f033c7022 Add test with just a single emoji followed by VS15 (invalid) 2025-11-24 09:26:01 -05:00
Jacob Sandlund
b58656be8a Merge branch 'uucode-update' into vs-correctness 2025-11-24 09:14:32 -05:00
Jacob Sandlund
61c7381452 Update comment. PR for wcwidth_standalone might be a bit 2025-11-24 09:14:03 -05:00
Jacob Sandlund
55c1cb3aad Merge branch 'uucode-update' into vs-correctness 2025-11-23 22:56:15 -05:00
Jacob Sandlund
62ec34072f fix typo 2025-11-23 22:56:00 -05:00
Jacob Sandlund
36c3295806 unicode: don't narrow invalid text presentation (VS15) sequences 2025-11-23 22:39:21 -05:00
Jacob Sandlund
97926ca307 Update uucode to the latest, for future width and grapheme break changes 2025-11-23 17:26:25 -05:00
Vinícius Soares
92aa960381 Add flag for quick terminal 2025-11-23 12:43:11 -03:00
Mitchell Hashimoto
df466f3c73 renderer: make cursorStyle depend on RenderState
This makes `cursorStyle` utilize `RenderState` to determine the
appropriate cursor style. This moves the cursor style logic outside the
critical area, although it was cheap to begin with.

This always removes `viewport_is_bottom` which had no practical use.
2025-11-22 14:36:53 -08:00
Mitchell Hashimoto
3283f57fd2 lib-vt: expose RenderState API 2025-11-21 16:01:22 -08:00
Mitchell Hashimoto
82f5c1a13c renderer: clear renderstate memory periodically 2025-11-21 09:03:03 -08:00
Mitchell Hashimoto
2ecaf4a595 font/shaper: fix harfbuzz tests 2025-11-20 22:00:44 -08:00