Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Key.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const std = @import("std");
const testing = std.testing;
const builtin = @import("builtin");

const Key = @This();

Expand Down Expand Up @@ -164,6 +165,11 @@ pub const escape: u21 = 0x1B;
pub const space: u21 = 0x20;
pub const backspace: u21 = 0x7F;

// For whatever reason, when you press cmd+backspace on macOS it's encoded as ctrl+forward_delete.
// forward_delete is encoded as 0x75, as per kVK_ForwardDelete in
// /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h
pub const forward_delete: u21 = if (builtin.os.tag == .macos) 0x75 else @compileError("forward_delete is only ever checked on macOS");

/// multicodepoint is a key which generated text but cannot be expressed as a
/// single codepoint. The value is the maximum unicode codepoint + 1
pub const multicodepoint: u21 = 1_114_112 + 1;
Expand Down