Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ep: Fix Unicode chars boundary (#49351)
Oleksiy Syvokon97a21c13b9cf
diff --git a/crates/edit_prediction_cli/src/format_prompt.rs b/crates/edit_prediction_cli/src/format_prompt.rsindex 113baf04d08..702af3091a2 100644--- a/crates/edit_prediction_cli/src/format_prompt.rs+++ b/crates/edit_prediction_cli/src/format_prompt.rs@@ -160,7 +160,7 @@ pub fn zeta2_output_for_patch(// We need to add where the hunk context matched in the editable region to compute// the actual cursor position in the result.let hunk_start = first_hunk_offset.unwrap_or(0);- let offset = (hunk_start + cursor_offset).min(result.len());+ let offset = result.floor_char_boundary((hunk_start + cursor_offset).min(result.len()));result.insert_str(offset, zeta_prompt::CURSOR_MARKER);}