editor: Translate utf16 to utf8 offsets in copy_highlight_json (#40981)
Fixes ZED-2FM Release Notes: - Fixed panic in copy highlight json action
This commit is contained in:
@@ -21351,7 +21351,10 @@ impl Editor {
|
||||
if selection.range.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(selection.range)
|
||||
Some(
|
||||
snapshot.offset_utf16_to_offset(OffsetUtf16(selection.range.start))
|
||||
..snapshot.offset_utf16_to_offset(OffsetUtf16(selection.range.end)),
|
||||
)
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|| 0..snapshot.len());
|
||||
|
||||
Reference in New Issue
Block a user