Compare commits

...

2 commits

View file

@ -3759,6 +3759,8 @@ pub const Editor = struct {
var cursel: CurSel = .{}; var cursel: CurSel = .{};
cursel.cursor = cursor; cursel.cursor = cursor;
try move_cursor_begin(root, &cursel.cursor, self.metrics); try move_cursor_begin(root, &cursel.cursor, self.metrics);
if (root.line_width(cursel.cursor.row, self.metrics) catch 0 == 0)
return root;
switch (self.indent_mode) { switch (self.indent_mode) {
.spaces, .auto => { .spaces, .auto => {
const cols = self.indent_size - find_first_non_ws(root, cursel.cursor.row, self.metrics) % self.indent_size; const cols = self.indent_size - find_first_non_ws(root, cursel.cursor.row, self.metrics) % self.indent_size;
@ -4522,7 +4524,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);