summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/main.zig b/src/main.zig
index c7f1f960..03bed908 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -340,6 +340,21 @@ fn libcResult(rc: usize) c_int {
return -1;
}
+fn parseCtrlKey(raw: []const u8) ?u21 {
+ var value = std.mem.trim(u8, raw, " \t\r\n");
+ if (value.len >= 5 and std.ascii.eqlIgnoreCase(value[0..5], "ctrl-")) {
+ value = value[5..];
+ } else if (value.len >= 5 and std.ascii.eqlIgnoreCase(value[0..5], "ctrl+")) {
+ value = value[5..];
+ } else if (value.len == 2 and value[0] == '^') {
+ value = value[1..];
+ }
+ if (value.len != 1) return null;
+ const c = std.ascii.toLower(value[0]);
+ if (c < 'a' or c > 'z' or c == 'c') return null;
+ return c;
+}
+
// init.gpa, what the tui, gui and detached shells allocate from, is their
// own fixed arena (memory.host) in a release build, spilling to libc's
// malloc, and std.start's DebugAllocator in Debug. Zig 0.17's std.start
@@ -1036,21 +1051,6 @@ fn crossAttach(init: std.process.Init, opts: pardes.Options, name: []const u8) n
remoteAttach(init, opts, sock, name);
}
-fn parseCtrlKey(raw: []const u8) ?u21 {
- var value = std.mem.trim(u8, raw, " \t\r\n");
- if (value.len >= 5 and std.ascii.eqlIgnoreCase(value[0..5], "ctrl-")) {
- value = value[5..];
- } else if (value.len >= 5 and std.ascii.eqlIgnoreCase(value[0..5], "ctrl+")) {
- value = value[5..];
- } else if (value.len == 2 and value[0] == '^') {
- value = value[1..];
- }
- if (value.len != 1) return null;
- const c = std.ascii.toLower(value[0]);
- if (c < 'a' or c > 'z' or c == 'c') return null;
- return c;
-}
-
/// Where Recent's file (0.24) and the store before it were kept:
/// $XDG_STATE_HOME/pardes, else ~/.local/state/pardes. A state file that
/// holds no Recent yet reads them once (Db.zig).