summaryrefslogtreecommitdiff
path: root/src/modal.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/modal.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/modal.zig')
-rw-r--r--src/modal.zig46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/modal.zig b/src/modal.zig
index 6f0bdc9c..f540b1a7 100644
--- a/src/modal.zig
+++ b/src/modal.zig
@@ -526,29 +526,6 @@ pub fn isUnicodeWhitespace(cp: u21) bool {
};
}
-/// A codepoint's word class: Unicode word characters, punctuation, or
-/// whitespace (line ends included; wordClassAt tells them apart).
-fn kindOfCodepoint(cp: u21) WordClass {
- if (isUnicodeWhitespace(cp)) return .ws;
- if (cp == '_') return .word;
- return switch (uucode.get(.general_category, cp)) {
- .letter_uppercase,
- .letter_lowercase,
- .letter_titlecase,
- .letter_modifier,
- .letter_other,
- .mark_nonspacing,
- .mark_spacing_combining,
- .mark_enclosing,
- .number_decimal_digit,
- .number_letter,
- .number_other,
- .punctuation_connector,
- => .word,
- else => .punct,
- };
-}
-
fn lineLenOf(lines: []const []const u8, row: usize) usize {
if (row >= lines.len) return 0;
return lines[row].len;
@@ -1042,6 +1019,29 @@ pub const WordTarget = enum {
// that distinction is load-bearing in reached_target.
const WordClass = enum { word, punct, ws, eol };
+/// A codepoint's word class: Unicode word characters, punctuation, or
+/// whitespace (line ends included; wordClassAt tells them apart).
+fn kindOfCodepoint(cp: u21) WordClass {
+ if (isUnicodeWhitespace(cp)) return .ws;
+ if (cp == '_') return .word;
+ return switch (uucode.get(.general_category, cp)) {
+ .letter_uppercase,
+ .letter_lowercase,
+ .letter_titlecase,
+ .letter_modifier,
+ .letter_other,
+ .mark_nonspacing,
+ .mark_spacing_combining,
+ .mark_enclosing,
+ .number_decimal_digit,
+ .number_letter,
+ .number_other,
+ .punctuation_connector,
+ => .word,
+ else => .punct,
+ };
+}
+
fn wordClassAt(text: []const u8, off: usize) WordClass {
if (off >= text.len) return .eol;
const cp = codepointAt(text, off);