ep: Fix Unicode chars boundary (#49351)

Oleksiy Syvokon created

Release Notes:

- N/A

Change summary

crates/edit_prediction_cli/src/format_prompt.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

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);
     }