Commit Graph

13133 Commits

Author SHA1 Message Date
Mitchell Hashimoto
cfbc219f5c macos: enter and shift+enter move the results 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
efc05523e0 macos: enter goes to next result 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
72708b8253 search: do not restart search if needle doesn't change 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
3ce19a02ba macos: hook up the next/prev search buttons 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
15f00a9cd1 renderer: setup proper dirty state on search selection changing 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
ad8a6e0642 search thread needs to take an allocated needle 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
5ee000f58f macos: search input starts the search up 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
081d73d850 macos: changes to SearchState trigger calls to internals 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
56d4a7f58e macos: start_search refocuses the search input 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
c61d28a3a4 macos: esc returns focus back to surface 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
b7e70ce534 apprt: end_search 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
b084889782 config: cmd+f on macos start_search default 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto
bc44b187d6 macos: hook up start_search apprt action to open 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
b87d57f029 macos: search overlay 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
14abc6a49d search: navigable search results (previous/next) (#9702)
Continuing #189

This adds the `navigate_search:previous` and `next` key bindings which
allow search matches to be navigated. The currently selected search
match is highlighted using a new `search-selected-foreground/background`
configuration with a reasonable default.

As search results are navigated, the viewport moves to keep them
visible.

## Demo



https://github.com/user-attachments/assets/facc9f3e-e327-4c65-b5f7-0279480ac357
2025-11-25 11:13:37 -08: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
Mitchell Hashimoto
9511b237f3 macOS: fix the animation of showing&hiding command palette (#9698)
https://github.com/user-attachments/assets/0069d634-4156-486f-9b59-141fb4565a19

> [!NOTE]
> AI proofread my comments.
2025-11-25 09:47:12 -08:00
Mitchell Hashimoto
727430c110 benchmarks: align read_buf to cache line (#9700)
This aligns the `read_buf`s in `src/benchmark` to the cache line, so
that we don't leave that alignment up to chance in case it can very
slightly affect the benchmarks.

I ran the before and after on a few of the benchmarks and I don't think
it changes much (data is 200 MiB from `ghostty-gen`):

### codepoint-width

<img width="1738" height="470" alt="CleanShot 2025-11-25 at 09 10 14@2x"
src="https://github.com/user-attachments/assets/f4ea3014-db21-4a4a-8d67-49161829a4b4"
/>

### grapheme-break

<img width="1726" height="470" alt="CleanShot 2025-11-25 at 09 10 51@2x"
src="https://github.com/user-attachments/assets/d99d220b-3221-4adc-b7f5-58c7b86765bb"
/>

### is-symbol

<img width="1654" height="466" alt="CleanShot 2025-11-25 at 09 11 09@2x"
src="https://github.com/user-attachments/assets/d55e6c12-a650-49cc-aee9-b887eccd42dd"
/>

AI: no AI, just a simple replace.
2025-11-25 09:46:25 -08:00
Jacob Sandlund
807febcb5e benchmarks: align read_buf to cache line 2025-11-25 09:07:21 -05:00
Lukas
2a627a4665 macOS: fix the animation of showing&hiding command palette 2025-11-25 11:22:14 +01:00
Mitchell Hashimoto
94e52ffcfb pkg/{highway,simdutf}: disable ubsan (#9696)
This causes linker issues for some libghostty users. I don't know why we
never saw these issues with Ghostty release builds, but generally
speaking I think its fine to do this for 3rd party code unless we've
witnessed an issue. And these deps have been stable for a long, long
time.
2025-11-24 21:23:11 -08:00
Mitchell Hashimoto
ee5dde795a fix(renderer): load linearized fg color for cursor cell (#9695)
It's clear from the surrounding code that the RGB values returned from
`cell_text_vertex` are expected to be linearized. This was not the case
for the cursor cell, resulting in the cursor text being too bright when
using `cursor-text = cell-background`.

Fixes #8353/#9138.

xref #8960, which would also fixe this issue, but I don't know where
that's heading
2025-11-24 21:22:02 -08:00
Mitchell Hashimoto
c92a003325 pkg/{highway,simdutf}: disable ubsan
This causes linker issues for some libghostty users. I don't know why we
never saw these issues with Ghostty release builds, but generally
speaking I think its fine to do this for 3rd party code unless we've
witnessed an issue. And these deps have been stable for a long, long
time.
2025-11-24 21:18:49 -08:00
Daniel Wennberg
d31be89b16 fix(renderer): load linearized fg color for cursor cell 2025-11-24 21:04:54 -08:00
Mitchell Hashimoto
6f0927c42a Search binding, viewport rendering (#9687)
The march towards #189 continues.

This hooks up the search thread to the main surface and all the state
necessary for the renderer to show search results in the viewport! This
also adds a `search` binding which takes a query to start/stop a search.
**This still doesn't add any search GUI,** which will come later, the
internals must happen first.

A non-blank binding will start or change the search term. An empty
binding will stop search:

```
keybind = cmd+f=search:Hello
keybind = shift+cmd+f=search:
```

> [!NOTE]
>
> Obviously, search will eventually have a GUI. The point of this PR is
primarily to connect all the various internal systems more than
anything. GUI will come soon.

## Demo


https://github.com/user-attachments/assets/06af5a3b-280e-4804-b506-419b92a95f99

## Major Changes

The only major changes required as part of this is the introduction of
what I'm calling the terminal "highlight" system. This is a generic
system for highlighting portions of the terminal contents. These will
ultimately underpin what we currently call "selections" (selecting text
with your mouse/keyboard) but that is far too large a change to make in
one PR.

Therefore, this PR introduces highlights and the only consumer is the
entire search subsystem.

## Limitations

Still plenty of limitations we need to keep marching towards resolving:

- ~~Search matches are styled the same as selections. They should be
different.~~
- There is no way to iterate search matches, yet.
- There is no GUI for inputting a search query or viewing total matches,
yet.
- ~~I think searches are case-sensitive currently and they should
probably not be.~~ Done, for ASCII.

But hey, it's something!
2025-11-24 20:32:06 -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