agent_ui: Fix panic when inserting context prefix with multi-byte characters (#48179)

Closes ZED-4R9

Introduced in https://github.com/zed-industries/zed/pull/47768

The `insert_context_prefix` function was using byte offsets to check if
the prefix already exists at the cursor. This caused a panic with
multi-byte characters like emojis. Now uses character counts instead.

Release Notes:

- Fixed a crash in the Agent Panel when inserting context mentions with
emojis in the message editor.
9ee0f08944Smit Barmase committed on 2/2/2026, 10:51:52 AM· committed by GitHubparent6d77257
1 file changedLine totals unavailable