fix: don't clip leading whitespace based on cursor column in smart_insert_line

This commit is contained in:
CJ van den Berg 2025-11-03 22:37:12 +01:00
parent 9026404d6d
commit cd1d9f3042
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -4522,7 +4522,7 @@ pub const Editor = struct {
fn cursel_smart_insert_line(self: *Self, root: Buffer.Root, cursel: *CurSel, b_allocator: std.mem.Allocator, mode: WSCollapseMode) !Buffer.Root { fn cursel_smart_insert_line(self: *Self, root: Buffer.Root, cursel: *CurSel, b_allocator: std.mem.Allocator, mode: WSCollapseMode) !Buffer.Root {
const row = cursel.cursor.row; const row = cursel.cursor.row;
const leading_ws = @min(find_first_non_ws(root, row, self.metrics), cursel.cursor.col); const leading_ws = find_first_non_ws(root, row, self.metrics);
var sfa = std.heap.stackFallback(512, self.allocator); var sfa = std.heap.stackFallback(512, self.allocator);
const sfa_allocator = sfa.get(); const sfa_allocator = sfa.get();
var stream: std.Io.Writer.Allocating = .init(sfa_allocator); var stream: std.Io.Writer.Allocating = .init(sfa_allocator);