4129 Commits

Author SHA1 Message Date
Mitchell Hashimoto
ed3e3764d9 renderer: faint should not be applied to bg alpha
Fixes #889
2023-11-15 11:38:16 -08:00
Mitchell Hashimoto
df99c6e8e0 core: comment out log statements 2023-11-15 10:57:51 -08:00
Mitchell Hashimoto
ad24e5e687 renderer/opengl: use new preedit format 2023-11-15 09:59:08 -08:00
Mitchell Hashimoto
7457b40a45 renderer/metal: handle preedit wider than our screen 2023-11-15 09:53:51 -08:00
Mitchell Hashimoto
50f0aaf26b renderer/metal: support multi-codepoint preedit text 2023-11-15 09:49:28 -08:00
Gregory Anders
689199251a core: use arrays instead of WriteReq for desktop notifications 2023-11-15 11:21:30 -06:00
Gregory Anders
86b7442f3c macos: implement desktop notifications 2023-11-15 11:21:30 -06:00
Mitchell Hashimoto
4cff8d972c input: do not encode enter with utf8 as pc style key
If the enter key has utf-8 attach, we assume its a dead key state being
committed so we don't process it.
2023-11-15 08:58:12 -08:00
Gregory Anders
54a489eefa macos: remove optional from Ghostty.AppState.surfaceUserdata
The return value of takeUnretainedValue() is non-optional, so this
function was never _actually_ returning an optional value, so the guard
clauses sprinkled throughout were unnecessary.
2023-11-15 10:36:45 -06:00
Gregory Anders
3f4ea2f763 core: support OSC 9 and OSC 777 for showing desktop notifications 2023-11-15 10:25:02 -06:00
Mitchell Hashimoto
1deafe34fb Merge pull request #881 from mitchellh/unknown-cmd
termio/exec: fall back to default command if specified command not found
2023-11-14 17:17:58 -08:00
Mitchell Hashimoto
83eff4e330 config: clarify that command can only be a single binary 2023-11-14 17:03:47 -08:00
Mitchell Hashimoto
822c67b3e0 termio/exec: fall back to default command if specified command not found
Fixes #880

If a command is specified but it can't be found, then we try to fallback
to a default command like "sh" and log the issue. This prevents Ghostty
from simply exiting.
2023-11-14 16:58:27 -08:00
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