@@ -345,6 +345,7 @@ pub mod util {
345345 line_ending: &str,
346346 include_placeholder: bool,
347347 tab_width: usize,
348+ indent_width: usize,
348349 ) -> Transaction {
349350 let text = doc.slice(..);
350351
@@ -374,19 +375,14 @@ pub mod util {
374375 let mapped_replacement_end = (replacement_end as i128 + off) as usize;
375376
376377 let line_idx = mapped_doc.char_to_line(mapped_replacement_start);
377− let pos_on_line = mapped_replacement_start - mapped_doc.line_to_char(line_idx);
378−
379− // we only care about the actual offset here (not virtual text/softwrap)
380− // so it's ok to use the deprecated function here
381− #[allow(deprecated)]
382− let width = helix_core::visual_coords_at_pos(
378+ let indent_level = helix_core::indent::indent_level_for_line(
383379 mapped_doc.line(line_idx),
384− pos_on_line,
385380 tab_width,
386− )
387− .col;
381+ indent_width,
382+ ) * indent_width;
383+
388384 let newline_with_offset = format!(
389− "{line_ending}{blank:width$}",
385+ "{line_ending}{blank:indent_level$}",
390386 line_ending = line_ending,
391387 blank = ""
392388 );