fix: use buf_for_update consistently in helix mode

This commit is contained in:
CJ van den Berg 2026-04-13 19:28:43 +02:00
parent 157e1ba7d3
commit 34d99a17d5
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -433,8 +433,8 @@ const cmds_ = struct {
pub fn surround_add(_: *void, ctx: Ctx) Result { pub fn surround_add(_: *void, ctx: Ctx) Result {
const mv = tui.mainview() orelse return; const mv = tui.mainview() orelse return;
const ed = mv.get_active_editor() orelse return; const ed = mv.get_active_editor() orelse return;
var root = ed.buf_root() catch return; const b = try ed.buf_for_update();
root = try ed.with_cursels_mut_once_arg(root, surround_cursel_add, ed.allocator, ctx); const root = try ed.with_cursels_mut_once_arg(b.root, surround_cursel_add, ed.allocator, ctx);
try ed.update_buf(root); try ed.update_buf(root);
ed.clamp(); ed.clamp();
ed.need_render(); ed.need_render();
@ -492,8 +492,8 @@ const cmds_ = struct {
pub fn replace_with_character_helix(_: *void, ctx: Ctx) Result { pub fn replace_with_character_helix(_: *void, ctx: Ctx) Result {
const mv = tui.mainview() orelse return; const mv = tui.mainview() orelse return;
const ed = mv.get_active_editor() orelse return; const ed = mv.get_active_editor() orelse return;
var root = ed.buf_root() catch return; const b = try ed.buf_for_update();
root = try ed.with_cursels_mut_once_arg(root, replace_cursel_with_character, ed.allocator, ctx); const root = try ed.with_cursels_mut_once_arg(b.root, replace_cursel_with_character, ed.allocator, ctx);
try ed.update_buf(root); try ed.update_buf(root);
ed.clamp(); ed.clamp();
ed.need_render(); ed.need_render();