Compare commits

...

4 commits

7 changed files with 34 additions and 18 deletions

View file

@ -1 +1 @@
0.14.0-dev.3091+42e48b83b
0.14.0-dev.3280+bbd13ab96

View file

@ -123,12 +123,12 @@ const Process = struct {
if (isdupe(self.backwards.getLastOrNull(), entry)) {
if (self.current) |current| self.forwards.append(current) catch {};
const top = self.backwards.pop();
if (self.backwards.pop()) |top|
self.allocator.free(top.file_path);
tp.trace(tp.channel.all, tp.message.fmt(.{ "location", "back", entry.file_path, entry.cursor.row, entry.cursor.col, self.backwards.items.len, self.forwards.items.len }));
} else if (isdupe(self.forwards.getLastOrNull(), entry)) {
if (self.current) |current| self.backwards.append(current) catch {};
const top = self.forwards.pop();
if (self.forwards.pop()) |top|
self.allocator.free(top.file_path);
tp.trace(tp.channel.all, tp.message.fmt(.{ "location", "forward", entry.file_path, entry.cursor.row, entry.cursor.col, self.backwards.items.len, self.forwards.items.len }));
} else if (self.current) |current| {

View file

@ -913,10 +913,11 @@ const FilteredWalker = struct {
var containing = top;
var dirname_len = top.dirname_len;
if (top.iter.next() catch {
var item = self.stack.pop();
var item_ = self.stack.pop();
if (item_) |*item|
if (self.stack.items.len != 0) {
item.iter.dir.close();
}
};
continue;
}) |base| {
self.name_buffer.shrinkRetainingCapacity(dirname_len);
@ -947,10 +948,11 @@ const FilteredWalker = struct {
else => continue,
}
} else {
var item = self.stack.pop();
var item_ = self.stack.pop();
if (item_) |*item|
if (self.stack.items.len != 0) {
item.iter.dir.close();
}
};
}
}
return null;

View file

@ -104,7 +104,7 @@ pub fn remove_all(self: *Self) void {
}
pub fn pop(self: *Self) ?Widget {
return if (self.widgets.popOrNull()) |ws| ws.widget else null;
return if (self.widgets.pop()) |ws| ws.widget else null;
}
pub fn empty(self: *const Self) bool {

View file

@ -629,7 +629,7 @@ pub const Editor = struct {
pub fn pop_cursor(self: *Self, _: Context) Result {
if (self.cursels.items.len > 1) {
const cursel = self.cursels.popOrNull() orelse return orelse return;
const cursel = self.cursels.pop() orelse return orelse return;
if (cursel.selection) |sel| if (self.find_selection_match(sel)) |match| {
match.has_selection = false;
};
@ -3994,6 +3994,20 @@ pub const Editor = struct {
}
pub const smart_insert_line_after_meta: Meta = .{ .description = "Insert line after (smart)" };
pub fn smart_buffer_append(self: *Self, ctx: Context) Result {
var chars: []const u8 = undefined;
if (!try ctx.args.match(.{tp.extract(&chars)}))
return error.InvalidInsertCharsArgument;
const b = try self.buf_for_update();
var root = b.root;
var cursel: CurSel = .{};
cursel.cursor.move_buffer_end(root, self.metrics);
root = try self.insert(root, &cursel, chars, b.allocator);
try self.update_buf(root);
self.clamp();
}
pub const smart_buffer_append_meta: Meta = .{ .arguments = &.{.string} };
pub fn enable_fast_scroll(self: *Self, _: Context) Result {
self.fast_scroll = true;
}

View file

@ -266,6 +266,7 @@ inline fn render_diff_symbols(self: *Self, diff_symbols: *[]Symbol, pos: usize,
}
fn render_diagnostics(self: *Self, theme: *const Widget.Theme) void {
if (tui.config().inline_diagnostics)
for (self.editor.diagnostics.items) |*diag| self.render_diagnostic(diag, theme);
}

View file

@ -847,8 +847,7 @@ const cmds = struct {
return error.InvalidShellOutputArgument;
const buffer = self.buffer_manager.buffer_from_ref(buffer_ref) orelse return;
if (self.get_active_editor()) |editor| if (editor.buffer) |eb| if (eb == buffer) {
editor.move_buffer_end(.{}) catch {};
editor.insert_chars(command.fmt(.{output})) catch {};
editor.smart_buffer_append(command.fmt(.{output})) catch {};
tui.need_render();
return;
};