diff --git a/src/command.zig b/src/command.zig index 179c4ef..523a0cf 100644 --- a/src/command.zig +++ b/src/command.zig @@ -2,7 +2,7 @@ const std = @import("std"); const tp = @import("thespian"); const log = @import("log"); -pub var context_check: ?*const fn() void = null; +pub var context_check: ?*const fn () void = null; pub const ID = usize; pub const ID_unknown = std.math.maxInt(ID); @@ -98,7 +98,7 @@ pub fn removeCommand(id: ID) void { } pub fn execute(id: ID, ctx: Context) tp.result { - if(context_check) |check| check(); + if (context_check) |check| check(); if (id >= commands.items.len) return tp.exit_fmt("CommandNotFound: {d}", .{id}); const cmd = commands.items[id]; diff --git a/src/syntax/src/file_types.zig b/src/syntax/src/file_types.zig index de1a26d..bdc567a 100644 --- a/src/syntax/src/file_types.zig +++ b/src/syntax/src/file_types.zig @@ -113,10 +113,10 @@ pub const gitcommit = .{ pub const gleam = .{ .color = 0xffaff3, .icon = "󰦥", - .extensions = .{ "gleam" }, + .extensions = .{"gleam"}, .comment = "//", - .language_server = .{"gleam", "lsp"}, - .formatter = .{"gleam", "format", "--stdin"}, + .language_server = .{ "gleam", "lsp" }, + .formatter = .{ "gleam", "format", "--stdin" }, }; pub const go = .{ diff --git a/src/tui/editor.zig b/src/tui/editor.zig index d27fa49..4ae0922 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -1081,7 +1081,7 @@ pub const Editor = struct { last_begin: Cursor = Cursor.invalid(), fn cb(ctx: *@This(), range: syntax.Range, scope: []const u8, id: u32, idx: usize, _: *const syntax.Node) error{Stop}!void { const sel_ = ctx.pos_cache.range_to_selection(range, ctx.root, ctx.self.metrics) orelse return; - + if (idx > 0) return; if (sel_.begin.eql(ctx.last_begin)) return; ctx.last_begin = sel_.begin; diff --git a/test/tests_buffer.zig b/test/tests_buffer.zig index 7b8160e..d9288d0 100644 --- a/test/tests_buffer.zig +++ b/test/tests_buffer.zig @@ -349,11 +349,11 @@ test "get_from_pos" { try std.testing.expectEqualDeep(result1[0..line0.len], line0); const result2 = buffer.root.get_from_pos(.{ .row = 1, .col = 5 }, &result_buf, metrics()); - try std.testing.expectEqualDeep(result2[0..line1.len - 5], line1[5..]); + try std.testing.expectEqualDeep(result2[0 .. line1.len - 5], line1[5..]); _, _, const root = try buffer.root.insert_chars(1, 3, " ", buffer.allocator, metrics()); buffer.update(root); const result3 = buffer.root.get_from_pos(.{ .row = 1, .col = 5 }, &result_buf, metrics()); - try std.testing.expectEqualDeep(result3[0..line1.len - 4], line1[4..]); + try std.testing.expectEqualDeep(result3[0 .. line1.len - 4], line1[4..]); }