refactor: run zig fmt

This commit is contained in:
CJ van den Berg 2025-02-05 11:06:57 +01:00
parent 28c9ea991d
commit f5e3e84b59
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 19 additions and 20 deletions

View file

@ -1,4 +1,4 @@
fontface: [] const u8 = "Cascadia Code", fontface: []const u8 = "Cascadia Code",
fontsize: u8 = 14, fontsize: u8 = 14,
initial_window_x: u16 = 1087, initial_window_x: u16 = 1087,

View file

@ -440,7 +440,7 @@ pub const scheme = .{
pub const sql = .{ pub const sql = .{
.description = "SQL", .description = "SQL",
.icon = "󰆼", .icon = "󰆼",
.extensions = .{ "sql" }, .extensions = .{"sql"},
.comment = "--", .comment = "--",
}; };
@ -467,7 +467,7 @@ pub const verilog = .{
.highlights = "nvim-treesitter/queries/verilog/highlights.scm", .highlights = "nvim-treesitter/queries/verilog/highlights.scm",
.injections = "nvim-treesitter/queries/verilog/injections.scm", .injections = "nvim-treesitter/queries/verilog/injections.scm",
.language_server = .{"verible-verilog-ls"}, .language_server = .{"verible-verilog-ls"},
.formatter = .{ "verible-verilog-format", "-" } .formatter = .{ "verible-verilog-format", "-" },
}; };
pub const toml = .{ pub const toml = .{

View file

@ -1949,12 +1949,12 @@ pub const Editor = struct {
} }
fn is_word_boundary_left_vim(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool { fn is_word_boundary_left_vim(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool {
if(is_white_space_at_cursor(root, cursor, metrics)) return false; if (is_white_space_at_cursor(root, cursor, metrics)) return false;
var next = cursor.*; var next = cursor.*;
next.move_left(root, metrics) catch return true; next.move_left(root, metrics) catch return true;
const next_is_white_space = is_white_space_at_cursor(root, &next, metrics); const next_is_white_space = is_white_space_at_cursor(root, &next, metrics);
if(next_is_white_space) return true; if (next_is_white_space) return true;
const curr_is_non_word = is_non_word_char_at_cursor(root, cursor, metrics); const curr_is_non_word = is_non_word_char_at_cursor(root, cursor, metrics);
const next_is_non_word = is_non_word_char_at_cursor(root, &next, metrics); const next_is_non_word = is_non_word_char_at_cursor(root, &next, metrics);
@ -1987,12 +1987,12 @@ pub const Editor = struct {
} }
fn is_word_boundary_right_vim(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool { fn is_word_boundary_right_vim(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool {
if(is_white_space_at_cursor(root, cursor, metrics)) return false; if (is_white_space_at_cursor(root, cursor, metrics)) return false;
var next = cursor.*; var next = cursor.*;
next.move_right(root, metrics) catch return true; next.move_right(root, metrics) catch return true;
const next_is_white_space = is_white_space_at_cursor(root, &next, metrics); const next_is_white_space = is_white_space_at_cursor(root, &next, metrics);
if(next_is_white_space) return true; if (next_is_white_space) return true;
const curr_is_non_word = is_non_word_char_at_cursor(root, cursor, metrics); const curr_is_non_word = is_non_word_char_at_cursor(root, cursor, metrics);
const next_is_non_word = is_non_word_char_at_cursor(root, &next, metrics); const next_is_non_word = is_non_word_char_at_cursor(root, &next, metrics);
@ -2427,7 +2427,7 @@ pub const Editor = struct {
if (all_stop) if (all_stop)
return error.Stop; return error.Stop;
return .{text.items, root}; return .{ text.items, root };
} }
pub fn cut_internal_vim(self: *Self, _: Context) Result { pub fn cut_internal_vim(self: *Self, _: Context) Result {
@ -2632,10 +2632,10 @@ pub const Editor = struct {
const b = try self.buf_for_update(); const b = try self.buf_for_update();
var root = b.root; var root = b.root;
if(std.mem.eql(u8, text[text.len-1..], "\n")) text = text[0..text.len-1]; if (std.mem.eql(u8, text[text.len - 1 ..], "\n")) text = text[0 .. text.len - 1];
if (std.mem.indexOfScalar(u8, text, '\n')) |idx| { if (std.mem.indexOfScalar(u8, text, '\n')) |idx| {
if(idx == 0) { if (idx == 0) {
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| { for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
try move_cursor_end(root, &cursel.cursor, self.metrics); try move_cursor_end(root, &cursel.cursor, self.metrics);
root = try self.insert(root, cursel, "\n", b.allocator); root = try self.insert(root, cursel, "\n", b.allocator);
@ -2677,7 +2677,7 @@ pub const Editor = struct {
pub fn cut_forward_internal(self: *Self, _: Context) Result { pub fn cut_forward_internal(self: *Self, _: Context) Result {
const b = try self.buf_for_update(); const b = try self.buf_for_update();
const text, const root= try self.cut_to(move_cursor_right, b.root); const text, const root = try self.cut_to(move_cursor_right, b.root);
self.set_clipboard_internal(text); self.set_clipboard_internal(text);
try self.update_buf(root); try self.update_buf(root);
self.clamp(); self.clamp();
@ -2702,7 +2702,7 @@ pub const Editor = struct {
pub fn cut_word_left_vim(self: *Self, _: Context) Result { pub fn cut_word_left_vim(self: *Self, _: Context) Result {
const b = try self.buf_for_update(); const b = try self.buf_for_update();
const text, const root= try self.cut_to(move_cursor_word_left_vim, b.root); const text, const root = try self.cut_to(move_cursor_word_left_vim, b.root);
self.set_clipboard_internal(text); self.set_clipboard_internal(text);
try self.update_buf(root); try self.update_buf(root);
self.clamp(); self.clamp();
@ -2719,7 +2719,7 @@ pub const Editor = struct {
pub fn cut_word_right_vim(self: *Self, _: Context) Result { pub fn cut_word_right_vim(self: *Self, _: Context) Result {
const b = try self.buf_for_update(); const b = try self.buf_for_update();
const text, const root= try self.cut_to(move_cursor_word_right_vim, b.root); const text, const root = try self.cut_to(move_cursor_word_right_vim, b.root);
self.set_clipboard_internal(text); self.set_clipboard_internal(text);
try self.update_buf(root); try self.update_buf(root);
self.clamp(); self.clamp();
@ -2870,7 +2870,6 @@ pub const Editor = struct {
} }
pub const move_word_left_vim_meta: Meta = .{ .description = "Move cursor left by word (vim)" }; pub const move_word_left_vim_meta: Meta = .{ .description = "Move cursor left by word (vim)" };
pub fn move_word_right(self: *Self, _: Context) Result { pub fn move_word_right(self: *Self, _: Context) Result {
const root = try self.buf_root(); const root = try self.buf_root();
self.with_cursors_const(root, move_cursor_word_right) catch {}; self.with_cursors_const(root, move_cursor_word_right) catch {};