mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-03 17:44:30 +00:00
Fix panic in set_scroll_anchor_remote
This commit is contained in:
parent
7ed3f5f392
commit
a46947d5d7
1 changed files with 6 additions and 4 deletions
|
@ -384,10 +384,12 @@ impl Editor {
|
||||||
) {
|
) {
|
||||||
hide_hover(self, cx);
|
hide_hover(self, cx);
|
||||||
let workspace_id = self.workspace.as_ref().map(|workspace| workspace.1);
|
let workspace_id = self.workspace.as_ref().map(|workspace| workspace.1);
|
||||||
let top_row = scroll_anchor
|
let snapshot = &self.buffer().read(cx).snapshot(cx);
|
||||||
.anchor
|
if !scroll_anchor.anchor.is_valid(snapshot) {
|
||||||
.to_point(&self.buffer().read(cx).snapshot(cx))
|
log::warn!("Invalid scroll anchor: {:?}", scroll_anchor);
|
||||||
.row;
|
return;
|
||||||
|
}
|
||||||
|
let top_row = scroll_anchor.anchor.to_point(snapshot).row;
|
||||||
self.scroll_manager
|
self.scroll_manager
|
||||||
.set_anchor(scroll_anchor, top_row, false, false, workspace_id, cx);
|
.set_anchor(scroll_anchor, top_row, false, false, workspace_id, cx);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue