Compare commits
No commits in common. "c0107e32e06e5687708e922691be4d9f9f9767ca" and "195ba1e385c35712396ed914cd0f4a8ce9b9c487" have entirely different histories.
c0107e32e0
...
195ba1e385
5 changed files with 18 additions and 57 deletions
|
|
@ -600,13 +600,12 @@ pub fn walk_tree_entry(self: *Self, m: tp.message) OutOfMemoryError!void {
|
|||
tp.extract(&file_color),
|
||||
}) catch return)) return;
|
||||
const mtime = (@as(i128, @intCast(mtime_high)) << 64) | @as(i128, @intCast(mtime_low));
|
||||
const ft = file_type_config.get(file_type) catch null;
|
||||
|
||||
self.longest_file_path = @max(self.longest_file_path, file_path.len);
|
||||
(try self.pending.addOne(self.allocator)).* = .{
|
||||
.path = try self.allocator.dupe(u8, file_path),
|
||||
.type = if (ft) |ft_| ft_.name else try self.allocator.dupe(u8, file_type),
|
||||
.icon = if (ft) |ft_| ft_.icon orelse &.{} else try self.allocator.dupe(u8, file_icon),
|
||||
.type = file_type,
|
||||
.icon = file_icon,
|
||||
.color = @intCast(file_color),
|
||||
.mtime = mtime,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ pub const BlameLine = struct {
|
|||
author_stamp: usize,
|
||||
};
|
||||
|
||||
pub var retain_symlinks: bool = true;
|
||||
|
||||
arena: std.heap.ArenaAllocator,
|
||||
allocator: Allocator,
|
||||
external_allocator: Allocator,
|
||||
|
|
@ -1601,14 +1599,7 @@ pub const StoreToFileError = error{
|
|||
WriteFailed,
|
||||
};
|
||||
|
||||
pub fn store_to_existing_file_const(self: *const Self, file_path_: []const u8) StoreToFileError!void {
|
||||
var file_path = file_path_;
|
||||
var link_buf: [std.fs.max_path_bytes]u8 = undefined;
|
||||
if (retain_symlinks) blk: {
|
||||
const link = cwd().readLink(file_path, &link_buf) catch break :blk;
|
||||
file_path = link;
|
||||
}
|
||||
|
||||
pub fn store_to_existing_file_const(self: *const Self, file_path: []const u8) StoreToFileError!void {
|
||||
var atomic = blk: {
|
||||
var write_buffer: [4096]u8 = undefined;
|
||||
const stat = cwd().statFile(file_path) catch
|
||||
|
|
|
|||
|
|
@ -89,8 +89,6 @@ keybind_mode: KeybindMode = .normal,
|
|||
dropdown_keybinds: DropdownKeybindMode = .standard,
|
||||
dropdown_limit: usize = 12,
|
||||
|
||||
retain_symlinks: bool = true,
|
||||
|
||||
include_files: []const u8 = "",
|
||||
|
||||
const default_actions = [_]IdleAction{.highlight_references};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ const root = @import("soft_root").root;
|
|||
const tracy = @import("tracy");
|
||||
const builtin = @import("builtin");
|
||||
const file_link = @import("file_link");
|
||||
const Buffer = @import("Buffer");
|
||||
|
||||
pub const renderer = @import("renderer");
|
||||
const input = @import("input");
|
||||
|
|
@ -155,8 +154,6 @@ fn init(allocator: Allocator) InitError!*Self {
|
|||
|
||||
var conf, const conf_bufs = root.read_config(@import("config"), allocator);
|
||||
|
||||
Buffer.retain_symlinks = conf.retain_symlinks;
|
||||
|
||||
if (@hasDecl(renderer, "install_crash_handler") and conf.start_debugger_on_crash)
|
||||
renderer.jit_debugger_enabled = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -169,14 +169,23 @@ const FilteredWalker = struct {
|
|||
try self.name_buffer.appendSlice(self.allocator, base.name);
|
||||
switch (base.kind) {
|
||||
.directory => {
|
||||
_ = try self.next_directory(&base, &top, &containing);
|
||||
continue;
|
||||
if (is_filtered_dir(base.name))
|
||||
continue;
|
||||
var new_dir = top.iter.dir.openDir(base.name, .{ .iterate = true }) catch |err| switch (err) {
|
||||
error.NameTooLong => @panic("unexpected error.NameTooLong"), // no path sep in base.name
|
||||
else => continue,
|
||||
};
|
||||
{
|
||||
errdefer new_dir.close();
|
||||
try self.stack.append(self.allocator, .{
|
||||
.iter = new_dir.iterateAssumeFirstIteration(),
|
||||
.dirname_len = self.name_buffer.items.len,
|
||||
});
|
||||
top = &self.stack.items[self.stack.items.len - 1];
|
||||
containing = &self.stack.items[self.stack.items.len - 2];
|
||||
}
|
||||
},
|
||||
.file => return self.name_buffer.items,
|
||||
.sym_link => if (try self.next_sym_link(&base, &top, &containing, 5)) |file|
|
||||
return file
|
||||
else
|
||||
continue,
|
||||
else => continue,
|
||||
}
|
||||
} else {
|
||||
|
|
@ -189,37 +198,4 @@ const FilteredWalker = struct {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
fn next_directory(self: *FilteredWalker, base: *const std.fs.Dir.Entry, top: **StackItem, containing: **StackItem) !void {
|
||||
if (is_filtered_dir(base.name))
|
||||
return;
|
||||
var new_dir = top.*.iter.dir.openDir(base.name, .{ .iterate = true }) catch |err| switch (err) {
|
||||
error.NameTooLong => @panic("unexpected error.NameTooLong"), // no path sep in base.name
|
||||
else => return,
|
||||
};
|
||||
{
|
||||
errdefer new_dir.close();
|
||||
try self.stack.append(self.allocator, .{
|
||||
.iter = new_dir.iterateAssumeFirstIteration(),
|
||||
.dirname_len = self.name_buffer.items.len,
|
||||
});
|
||||
top.* = &self.stack.items[self.stack.items.len - 1];
|
||||
containing.* = &self.stack.items[self.stack.items.len - 2];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fn next_sym_link(self: *FilteredWalker, base: *const std.fs.Dir.Entry, top: **StackItem, containing: **StackItem, stat_depth: usize) !?[]const u8 {
|
||||
if (stat_depth == 0) return null;
|
||||
const st = top.*.iter.dir.statFile(base.name) catch return null;
|
||||
switch (st.kind) {
|
||||
.directory => {
|
||||
_ = try self.next_directory(base, top, containing);
|
||||
return null;
|
||||
},
|
||||
.file => return self.name_buffer.items,
|
||||
.sym_link => return try self.next_sym_link(base, top, containing, stat_depth - 1),
|
||||
else => return null,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue