Merge remote-tracking branch 'upstream/main' into titlebar-unzoom-button

This commit is contained in:
Pete Schaffner
2024-04-05 21:15:45 +02:00
3 changed files with 40 additions and 14 deletions

View File

@ -529,6 +529,13 @@ $ sudo apt install libgtk-4-dev libadwaita-1-dev git
> Ubuntu 23.10 is 6.5.0 which has a bug which > Ubuntu 23.10 is 6.5.0 which has a bug which
> [causes zig to fail its hash check for packages](https://github.com/ziglang/zig/issues/17282). > [causes zig to fail its hash check for packages](https://github.com/ziglang/zig/issues/17282).
> [!WARNING]
>
> GTK 4.14 on Wayland has a bug which may cause an immediate crash.
> There is an [open issue](https://gitlab.gnome.org/GNOME/gtk/-/issues/6589/note_2072039)
> to track this GTK bug. You can workaround this issue by running ghostty with
> `GDK_DEBUG=gl-disable-gles ghostty`
On Arch Linux, use On Arch Linux, use
``` ```

View File

@ -374,8 +374,10 @@ class AppDelegate: NSObject,
syncMenuShortcuts() syncMenuShortcuts()
terminalManager.relabelAllTabs() terminalManager.relabelAllTabs()
// Config could change window appearance // Config could change window appearance. We wrap this in an async queue because when
syncAppearance() // this is called as part of application launch it can deadlock with an internal
// AppKit mutex on the appearance.
DispatchQueue.main.async { self.syncAppearance() }
// Update all of our windows // Update all of our windows
terminalManager.windows.forEach { window in terminalManager.windows.forEach { window in

View File

@ -254,20 +254,23 @@ fn legacy(
self.ignore_keypad_with_numlock, self.ignore_keypad_with_numlock,
self.modify_other_keys_state_2, self.modify_other_keys_state_2,
)) |sequence| pc_style: { )) |sequence| pc_style: {
// If we're pressing enter or escape and have UTF-8 text, we probably // If we have UTF-8 text, then we never emit PC style function
// are clearing a dead key state. This happens specifically on macOS. // keys. Many function keys (escape, enter, backspace) have
// "Clearing" a dead key state may or may not commit the dead key // a specific meaning when dead keys are active and so we don't
// state; this differs by language: // want to send that to the terminal. Examples:
// //
// - Japanese clears and does not write the characters. // - Japanese: escape clears the dead key state
// - Korean clears and writes the characters. // - Korean: escape commits the dead key state
// - Korean: backspace should delete a single preedit char
// //
// We have a unit test for this. if (self.event.utf8.len > 0) {
if ((self.event.key == .enter or switch (self.event.key) {
self.event.key == .escape) and else => {},
self.event.utf8.len > 0) .enter,
{ .escape,
break :pc_style; .backspace,
=> break :pc_style,
}
} }
return copyToBuf(buf, sequence); return copyToBuf(buf, sequence);
@ -1644,6 +1647,20 @@ test "kitty: keypad number" {
try testing.expectEqualStrings("[57400;;49u", actual[1..]); try testing.expectEqualStrings("[57400;;49u", actual[1..]);
} }
test "legacy: backspace with utf8 (dead key state)" {
var buf: [128]u8 = undefined;
var enc: KeyEncoder = .{
.event = .{
.key = .backspace,
.utf8 = "A",
.unshifted_codepoint = 0x0D,
},
};
const actual = try enc.legacy(&buf);
try testing.expectEqualStrings("A", actual);
}
test "legacy: enter with utf8 (dead key state)" { test "legacy: enter with utf8 (dead key state)" {
var buf: [128]u8 = undefined; var buf: [128]u8 = undefined;
var enc: KeyEncoder = .{ var enc: KeyEncoder = .{