From 4423bc2f88fe2e88202056d6a11f759b4b143b74 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:02:01 -0300 Subject: modal, selection_pipe, syntax, sam_edit: helpers used once are inlined where they are used (consumeCount, clampLineCol, codepointAtCursor, isWordBoundary, wmIsPrev, tokenStopped, dropDiffPieces, Exec.text), and moveWord's doc comment goes back above moveWord Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/syntax.zig | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/syntax.zig') diff --git a/src/syntax.zig b/src/syntax.zig index 858ef6a2..acbe543a 100644 --- a/src/syntax.zig +++ b/src/syntax.zig @@ -188,7 +188,11 @@ pub fn stop() void { spec.objects = null; spec.objects_failed = false; } - dropDiffPieces(); + for (&diff_pieces) |*slot| { + if (slot.*) |piece| syntax_allocator.free(piece.styles); + slot.* = null; + } + diff_clock = 0; ts_set_allocator(null, null, null, null); syntax_started = false; syntax_allocator = undefined; @@ -1181,14 +1185,6 @@ const DiffPiece = struct { hash: u64, styles: []u8, used: u64 }; var diff_pieces: [96]?DiffPiece = @splat(null); var diff_clock: u64 = 0; -fn dropDiffPieces() void { - for (&diff_pieces) |*slot| { - if (slot.*) |piece| syntax_allocator.free(piece.styles); - slot.* = null; - } - diff_clock = 0; -} - /// The styles of `content[start..end)` read as a unified diff: headers /// muted, `@@` lines as keywords, and each hunk's code in the language of /// the file its section names. A hunk's old side (context and removed -- cgit v1.3