summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-09 02:14:21 -0300
committerGabriel Schneider <[email protected]>2026-11-09 02:21:58 -0300
commitbfb74e76ef7dfe305a26010edc86dac456034c3e (patch)
treec90744aa2e0edf37c8e6cbc0033476230a086412 /src/main.zig
parentc78d362fa20393621ac198861f891439f9d832e9 (diff)
downloadpardes-bfb74e76ef7dfe305a26010edc86dac456034c3e.tar.gz
pardes-bfb74e76ef7dfe305a26010edc86dac456034c3e.zip
locality: single-caller helpers beside their caller: File's placeOf and restoreName beside undoStep, Query's row makers (clearPlaces, makeAllRows, makeNameRows, feedGrepPlaces) beside produce, look's helpers beside lookAt, lookSpanIn and lookUnresolved, mouse's beside handleMouse and dragUpdate, normal's beside handleNormal and executeNormalAction, and the rest in Core, draw, exec, layout, main, modal, replica, syntax, terminal; Messages.printRight into draw.zig beside joinNotice and edit.spanHas into exec.zig beside operandAt, their only callers
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
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).