fix: don't stop unindenting on blank or full unindented lines

closes #263
This commit is contained in:
CJ van den Berg 2025-07-03 09:39:03 +02:00
parent 338d7f7bf3
commit c6d59c1472
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -3634,7 +3634,7 @@ pub const Editor = struct {
var cursel: CurSel = .{}; var cursel: CurSel = .{};
cursel.cursor = cursor.*; cursel.cursor = cursor.*;
const first = find_first_non_ws(root, cursel.cursor.row, self.metrics); const first = find_first_non_ws(root, cursel.cursor.row, self.metrics);
if (first == 0) return error.Stop; if (first == 0) return root;
const off = first % self.indent_size; const off = first % self.indent_size;
const cols = if (off == 0) self.indent_size else off; const cols = if (off == 0) self.indent_size else off;
const sel = cursel.enable_selection(root, self.metrics) catch return error.Stop; const sel = cursel.enable_selection(root, self.metrics) catch return error.Stop;