Fix invalid highlight position for (edited) text (#9660)

This pull request fixes a bug that was inserting the wrong position for
the `(edited)` text. This is only an issue when you have other styling
inside the markdown that causes the `richt_text.text.len()` to increase.

**Before**
<img wdth="234" alt="Screenshot 2024-03-21 at 19 53 34"
src="https://github.com/zed-industries/zed/assets/62463826/bf9e7fec-1563-415b-9b14-f7b95fc7d784">
**After**
<img width="234" alt="Screenshot 2024-03-21 at 19 53 48"
src="https://github.com/zed-industries/zed/assets/62463826/c0b7ba3a-5bdc-4b9e-a4f2-c3df4064f0ec">

Release Notes:

- N/A
This commit is contained in:
Remco Smits 2024-03-21 20:37:45 +01:00 committed by GitHub
parent 3b7cd9cf1e
commit 35e3935e8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -762,7 +762,7 @@ impl ChatPanel {
if message.edited_at.is_some() {
rich_text.highlights.push((
message.body.len()..(message.body.len() + MESSAGE_UPDATED.len()),
(rich_text.text.len() - MESSAGE_UPDATED.len())..rich_text.text.len(),
Highlight::Highlight(HighlightStyle {
fade_out: Some(0.8),
..Default::default()