Remove focused field and use FocusHandle instead in Editor

This commit is contained in:
Antonio Scandurra 2023-11-07 12:46:31 +01:00
parent a866370dc1
commit 6ae09634ce
5 changed files with 276 additions and 278 deletions

View file

@ -159,16 +159,14 @@ impl FollowableItem for Editor {
self.buffer.update(cx, |buffer, cx| {
buffer.remove_active_selections(cx);
});
} else {
} else if self.focus_handle.is_focused(cx) {
self.buffer.update(cx, |buffer, cx| {
if self.focused {
buffer.set_active_selections(
&self.selections.disjoint_anchors(),
self.selections.line_mode,
self.cursor_shape,
cx,
);
}
buffer.set_active_selections(
&self.selections.disjoint_anchors(),
self.selections.line_mode,
self.cursor_shape,
cx,
);
});
}
cx.notify();