mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 05:00:16 +00:00
Fix panic clicking on multibyte chars (#14086)
Fixes: #12011 When hovering over a multibyte character in a debug build, Zed would panic. Follow up to #11296 Release Notes: - N/A
This commit is contained in:
parent
77b31d1845
commit
3ff738fa03
1 changed files with 11 additions and 5 deletions
|
@ -709,18 +709,24 @@ impl EditorElement {
|
|||
let Some(hub) = editor.collaboration_hub() else {
|
||||
return;
|
||||
};
|
||||
let range = DisplayPoint::new(point.row(), point.column().saturating_sub(1))
|
||||
..DisplayPoint::new(
|
||||
let start = snapshot.display_snapshot.clip_point(
|
||||
DisplayPoint::new(point.row(), point.column().saturating_sub(1)),
|
||||
Bias::Left,
|
||||
);
|
||||
let end = snapshot.display_snapshot.clip_point(
|
||||
DisplayPoint::new(
|
||||
point.row(),
|
||||
(point.column() + 1).min(snapshot.line_len(point.row())),
|
||||
);
|
||||
),
|
||||
Bias::Right,
|
||||
);
|
||||
|
||||
let range = snapshot
|
||||
.buffer_snapshot
|
||||
.anchor_at(range.start.to_point(&snapshot.display_snapshot), Bias::Left)
|
||||
.anchor_at(start.to_point(&snapshot.display_snapshot), Bias::Left)
|
||||
..snapshot
|
||||
.buffer_snapshot
|
||||
.anchor_at(range.end.to_point(&snapshot.display_snapshot), Bias::Right);
|
||||
.anchor_at(end.to_point(&snapshot.display_snapshot), Bias::Right);
|
||||
|
||||
let Some(selection) = snapshot.remote_selections_in_range(&range, hub, cx).next() else {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue