3816 Commits

Author SHA1 Message Date
Mitchell Hashimoto
903838881a Merge pull request #879 from mitchellh/update-zig
update zig
2023-11-14 09:24:43 -08:00
Mitchell Hashimoto
256e146453 Merge pull request #836 from mitchellh/pf/docs
Revise key sections of docs
2023-11-14 09:23:32 -08:00
Mitchell Hashimoto
648a521fb2 slight edits 2023-11-14 09:21:45 -08:00
Mitchell Hashimoto
d3f3d10b2f update zig 2023-11-14 09:01:37 -08:00
Mitchell Hashimoto
76353415a3 ci: release-tip only works on this repository 2023-11-14 08:41:59 -08:00
Mitchell Hashimoto
7012fdb0f6 Merge pull request #878 from mitchellh/adwaita-runtime
apprt/gtk: gtk-adwaita runtime config to configure libadwaita
2023-11-14 08:36:11 -08:00
Mitchell Hashimoto
36c3b1b3d1 apprt/gtk: gtk-adwaita runtime config to configure libadwaita
Fixes #874
2023-11-14 08:33:55 -08:00
Mitchell Hashimoto
ab948f6f8f macos: reuse original event if translation mods changes nothing
Fixes #766 (again)

This is a repeat fix of 766 after fixing a number of other regressions
from the original fix. See the comment for reasons.
2023-11-14 08:14:24 -08:00
Mitchell Hashimoto
19bd4965aa Merge pull request #875 from mitchellh/macos-alt-2
macos: ignore alt key with other modifiers set
2023-11-13 19:25:48 -08:00
Mitchell Hashimoto
35e78939e5 macos: ignore alt key with other modifiers set
This enables shifted alt-prefixed keys, such as `shift+alt+.` on
US standard becoming `M->`. To do this, we needed to fix a few bugs:

  (1) translation mods should strip alt even if other mods are set
  (2) AppKit translation event needs to construct new characters with
      the translation mods.
  (3) Alt-prefix handling in KeyEncoder needs to allow ASCII utf8
      translations even for macOS.
2023-11-13 19:21:51 -08:00
Mitchell Hashimoto
ae112f48b9 Merge pull request #873 from mitchellh/macos-alt
macOS: filter option-as-alt properly at AppKit layer
2023-11-13 14:05:52 -08:00
Mitchell Hashimoto
63e106390f input: fix failing test on Linux 2023-11-13 13:58:41 -08:00
Mitchell Hashimoto
b4d393fdcf input: process alt-prefix even if utf8 text doesn't exist 2023-11-13 13:50:00 -08:00
Mitchell Hashimoto
5001e2c60c macos: filter option in AppKit when option-as-alt set
Fixes #872

In #867 we fixed macos-option-as-alt, but unfortunately AppKit ALSO does
some translation so some behaviors were not working correctly.
Specifically, when you had macos-option-as-alt set, option+e would
properly send `esc+e` to the pty but it would ALSO set the dead key
state for "`" since AppKit was still translating the option key.

This commit introduces a function to strip alt when necessary from the
translation modifiers used at the AppKit layer, preventing this
behavior.
2023-11-13 13:26:37 -08:00
Mitchell Hashimoto
a8e82b13ce Merge pull request #868 from der-teufel-programming/win-noxdg
os/xdg: Add `LOCALAPPDATA` as a fallback for `XDG_CONFIG_HOME` on Windows
2023-11-12 22:23:00 -08:00
Mitchell Hashimoto
f3c4c87ffd Merge pull request #870 from mitchellh/xt
xterm audit: DEC mode 3 (DECCOLM), 4 (DECSCLM), 40 (132COLS)
2023-11-12 22:21:36 -08:00
Mitchell Hashimoto
3192b13546 terminal: our mode size changed 2023-11-12 22:20:28 -08:00
Mitchell Hashimoto
df800fb0b3 xterm audit: reverse video (DECSCNM) 2023-11-12 22:18:53 -08:00
Mitchell Hashimoto
8783f6c925 xterm audit: slow scroll (DECSCLM) 2023-11-12 22:11:11 -08:00
Mitchell Hashimoto
f00c87e805 xterm audit: DECCOLM and 132COLS 2023-11-12 22:05:26 -08:00
Krzysztof Wolicki
0822e99a56 os/xdg: Add LOCALAPPDATA as a fallback for XDG_CONFIG_HOME on Windows 2023-11-13 02:05:29 +01:00
Mitchell Hashimoto
8d0404066f Merge pull request #867 from mitchellh/option-as-alt
macos-option-as-alt works again
2023-11-12 15:31:28 -08:00
Mitchell Hashimoto
86fbc6a85b macos-option-as-alt works again
This regressed sometime -- I can't find the exact commit -- but in any
case I've moved this handling directly into the KeyEncoder so we can
unit test it and prevent future regressions.
2023-11-12 15:26:55 -08:00
Mitchell Hashimoto
cfdd99691f Merge pull request #866 from mitchellh/termio-deadlock
termio: Fix deadlock when writer mailbox is full
2023-11-12 09:11:58 -08:00
Mitchell Hashimoto
c8ffc903be termio: Fix deadlock when writer mailbox is full
Fixes #865
Related to #861

In #861, we fixed a deadlock that could happen if the writer mailbox was
full from the reader thread by waking up the writer thread for
processing.

Unfortunately, the writer thread ALSO handles messages that require the
terminal lock (i.e. resizing, focus state, etc.). If the mailbox
contains these messages, it cannot make forward progress on the writes
(which do not require a lock). This makes it possible still under heavy
write scenarios to fully deadlock the read/write threads.

This commit modifies the behavior so that while we are attempting to
queue a writer message after it fails, we release the lock. This is a
very slow path since we are releasing/acquiring locks under heavy
contention. We can improve it in the future but for now its okay because
this is also a rare situation that only happens under the heaviest loads
that also produce heavy writes.
2023-11-12 09:09:39 -08:00
Mitchell Hashimoto
b3dd07a496 Merge pull request #864 from mitchellh/select-word
core: Fix various double-click word selection bugs
2023-11-11 23:04:14 -08:00
Mitchell Hashimoto
af6cc66369 core: Fix various double-click word selection bugs
Fixes #741

This completely reimplements double-click-and-drag logic for selecting
by word. The previous implementation was horribly broken. See #741 for
all the details.

The implemented logic now is:

* A double-click initiates a select-by-word selection mechanism.
  - A double-click may start on a word or whitespace
  - If the initial double-click is on a word, that word is immediately selected.
  - If the initial double-click is on whitespace, the whitespace is not selected.
* A "word" is determined by a non-boundary character meeting a boundary character.
  - A boundary character is `NUL` ` ` (space) `\t` `'` `"`
  - This list is somewhat arbitrary to make the terminal "feel" good.
  - Cell SGR states (fg/bg, bold, italic, etc.) have no effect on boundary determination or selection logic.
* As the user drags _on the same line_:
  - No selection change occurs until the cursor is over a new word. Whitespace change does nothing.
  - When selection is over a new word, that entire word added to the selection.
* When the user drags _up_ one or more lines:
  - If the cursor is over whitespace, all lines from the selection point up to but not including the cursor line are selected.
    * This selection is done in accordance to the previous rules.
  - If the cursor is over a word, the word becomes the beginning of the selection.
  - The end of the selection in all cases is the first word at or before the initial double-click point.
* When the user drags _down_ one or more lines:
  - The same logic as _up_ but swap the "beginning" and "end" of selection terminology.
* With this logic, the behavior of Ghostty has the following invariants:
  - Whitespace is never selected unless it is between two selected words
  - Selection implies at least one word is highlighted
  - The initial double-click point marks the beginning or end of a selection, never the middle.
2023-11-11 22:45:31 -08:00
Mitchell Hashimoto
d0a5faf57d Merge pull request #857 from gpanders/osc52-prompt
Implement user prompts for accessing clipboard via OSC 52
2023-11-11 15:16:12 -08:00
Mitchell Hashimoto
2489ef4c13 stylistic tweaks 2023-11-11 15:15:52 -08:00
Gregory Anders
e7bc9958da Prefer explicit type syntax over @as 2023-11-11 17:26:59 -05:00
Gregory Anders
06cdbc1a96 config: export ClipboardAccess 2023-11-11 17:25:48 -05:00
Gregory Anders
593cfa256c glfw: fix compile error 2023-11-11 17:21:10 -05:00
Mitchell Hashimoto
eab35d0164 Merge pull request #862 from mitchellh/mrn/macos-menubar-non-native
macOS: only unhide menu in non-native FS if focus lost to Ghostty
2023-11-11 09:48:13 -08:00
Thorsten Ball
ae9d7fc76a macOS: only unhide manu in non-native FS if focus lost to Ghostty
This fixes #786 by adding a check to the callback that unhides the menu
bar to only unhide the menu bar if focus was lost to another Ghostty
window.

That's the desired behaviour: when focus is lost to another app's
window, we want the non-native-fullscreen window to stay unchanged in
background, but when changing focus to another Ghostty window, we want
to unhide the menu bar.

Why did this problem even show up?

It started to show up with the introduction of the Xib-file based
approach, in 3018377.

Before that, in 27ddc90, for example, the app would receive the same
notifications, but the `.autoHideMenuBar` didn't have an effect on the
window. Only after adding the Xib-file did it start to have an effect.

So I figured there's two ways we could fix it:

1. Figure out why the `.autoHideMenuBar` now works with Xib-files and
   suppress it, or
2. Encode in the code the behaviour that we actually want: we only want
   to show the menu bar when focus shifts to another one of Ghostty's
   windows, but we want to leave it untouched when focus is lost to
   another app's window.

I went with (2) but I think (1) is also valid and happy to close PR if
that's what we want to do.
2023-11-11 07:41:12 +01:00
Mitchell Hashimoto
9a45bde44e Merge pull request #861 from mitchellh/writer-block
termio: wake up writer thread if the writer mailbox is full
2023-11-10 22:06:35 -08:00
Mitchell Hashimoto
8fcdd56496 Merge pull request #860 from mitchellh/ct-leading
font/coretext: ignore typographic leading when calculating cell height
2023-11-10 22:04:17 -08:00
Mitchell Hashimoto
bde9b02db3 termio: wake up writer thread if the writer mailbox is full
Normally, we queue all the writes we need from a single `read()` syscall
and only wake up the writer thread at the end of processing that batch
of data.

But under very heavy load or large batches of data, it is possible for the
terminal sequences to generate enough writes to the pty to fill the
writer thread queue while we're still processing the data from `read()`.

This modifies our queuer to attempt to queue, but if the queue is full
we wake up the writer thread immediately then queue again (which should
succeed in every case -- eventually).
2023-11-10 22:01:07 -08:00
Mitchell Hashimoto
947ebc0697 font/coretext: split typographic leading equally when calculating cell height
This maybe is a robust way to get Monaspace fonts working.

Previously, we used leading as part of the calculation in cell height. I
don't remember why. It appears most popular monospace fonts (Fira Code,
Berkeley Mono, JetBrains Mono, Monaco are the few I tested) have a value
of 0 for leading, so this has no effect. But some fonts like Monaspace
have a non-zero (positive) value, resulting in overly large cell
heights.

The issue is that we simply add leading to the height, without modifying
ascent. Normally this is what you want (normal typesetting) but for
terminals, we're trying to set text centered vertically in equally
spaced grid cells. For this, we want to split the leading between the
top and bottom.
2023-11-10 21:41:49 -08:00
Gregory Anders
98b43007a0 core: use ClipboardRequestType instead of ClipboardPromptReason
Instead of making a separate enum that must be translated from the
ClipboardRequest type, simply re-use ClipboardRequest to determine the
clipboard confirmation reason.
2023-11-10 23:12:39 -05:00
Gregory Anders
2a64180ebd config: rename ClipboardRequest to ClipboardAccess 2023-11-10 23:12:39 -05:00
Gregory Anders
9d3385703d gtk: fix memory leak in GTK clipboard confirmation window 2023-11-10 23:12:39 -05:00
Gregory Anders
960a1bb091 gtk: implement OSC 52 prompts 2023-11-10 23:12:39 -05:00
Gregory Anders
86245ff0cf macos: add option to prompt user for confirmation on OSC 52 commands 2023-11-10 23:12:39 -05:00
Mitchell Hashimoto
ace5693957 Merge pull request #859 from mitchellh/physical-tab
config: default goto_tab bindings on darwin based on physical key
2023-11-10 17:37:44 -08:00
Mitchell Hashimoto
e32b955c65 Merge pull request #858 from mitchellh/wide-preedit
core, renderer: handle wide preedit chars
2023-11-10 17:37:35 -08:00
Mitchell Hashimoto
725e017234 config: default goto_tab bindings on darwin based on physical key
Fixes #817
2023-11-10 17:36:39 -08:00
Mitchell Hashimoto
5c8c4bb06e renderer/opengl: handle wide preedit 2023-11-10 17:30:14 -08:00
Mitchell Hashimoto
ce4541dd61 core, renderer: handle wide preedit chars
Fixes #855
2023-11-10 17:26:36 -08:00
Mitchell Hashimoto
a8614815d6 Merge pull request #856 from mitchellh/asian-input
macos: handle preedit in AppKit, enables Korean input
2023-11-10 10:08:34 -08:00
Mitchell Hashimoto
dd1faf5e50 macos: handle preedit in AppKit, enables Korean input 2023-11-10 09:53:56 -08:00