feat: reflow current line if there is no selection

This commit is contained in:
CJ van den Berg 2026-02-01 20:20:34 +01:00
parent a3ea183ba1
commit ec71a7041b
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -6849,6 +6849,8 @@ pub const Editor = struct {
pub fn reflow(self: *Self, ctx: Context) Result { pub fn reflow(self: *Self, ctx: Context) Result {
const b = try self.buf_for_update(); const b = try self.buf_for_update();
if (!self.has_secondary_cursors()) if (self.get_primary().selection == null)
try self.select_line_at_cursor(b.root, self.get_primary(), .exclude_eol);
const root = try self.with_cursels_mut_once_arg(b.root, reflow_cursel, b.allocator, ctx); const root = try self.with_cursels_mut_once_arg(b.root, reflow_cursel, b.allocator, ctx);
try self.update_buf(root); try self.update_buf(root);
self.clamp(); self.clamp();