Fix single-line editors not working anymore (#10994)
This was introduced with #10979 and was caused by a missing call to `cx.set_view_id` in `EditorElement`, which is necessary when rendering `EditorElement` manually instead of via a view. Release Notes: - N/A
This commit is contained in:
@@ -23,11 +23,11 @@ use git::{blame::BlameEntry, diff::DiffHunkStatus, Oid};
|
|||||||
use gpui::{
|
use gpui::{
|
||||||
anchored, deferred, div, fill, outline, point, px, quad, relative, size, svg,
|
anchored, deferred, div, fill, outline, point, px, quad, relative, size, svg,
|
||||||
transparent_black, Action, AnchorCorner, AnyElement, AvailableSpace, Bounds, ClipboardItem,
|
transparent_black, Action, AnchorCorner, AnyElement, AvailableSpace, Bounds, ClipboardItem,
|
||||||
ContentMask, Corners, CursorStyle, DispatchPhase, Edges, Element, ElementInputHandler, Hitbox,
|
ContentMask, Corners, CursorStyle, DispatchPhase, Edges, Element, ElementInputHandler, Entity,
|
||||||
Hsla, InteractiveElement, IntoElement, ModifiersChangedEvent, MouseButton, MouseDownEvent,
|
Hitbox, Hsla, InteractiveElement, IntoElement, ModifiersChangedEvent, MouseButton,
|
||||||
MouseMoveEvent, MouseUpEvent, PaintQuad, ParentElement, Pixels, ScrollDelta, ScrollWheelEvent,
|
MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, ParentElement, Pixels, ScrollDelta,
|
||||||
ShapedLine, SharedString, Size, Stateful, StatefulInteractiveElement, Style, Styled, TextRun,
|
ScrollWheelEvent, ShapedLine, SharedString, Size, Stateful, StatefulInteractiveElement, Style,
|
||||||
TextStyle, TextStyleRefinement, View, ViewContext, WeakView, WindowContext,
|
Styled, TextRun, TextStyle, TextStyleRefinement, View, ViewContext, WeakView, WindowContext,
|
||||||
};
|
};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use language::language_settings::ShowWhitespaceSetting;
|
use language::language_settings::ShowWhitespaceSetting;
|
||||||
@@ -3417,6 +3417,7 @@ impl Element for EditorElement {
|
|||||||
line_height: Some(self.style.text.line_height),
|
line_height: Some(self.style.text.line_height),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
cx.set_view_id(self.editor.entity_id());
|
||||||
cx.with_text_style(Some(text_style), |cx| {
|
cx.with_text_style(Some(text_style), |cx| {
|
||||||
cx.with_content_mask(Some(ContentMask { bounds }), |cx| {
|
cx.with_content_mask(Some(ContentMask { bounds }), |cx| {
|
||||||
let mut snapshot = self.editor.update(cx, |editor, cx| editor.snapshot(cx));
|
let mut snapshot = self.editor.update(cx, |editor, cx| editor.snapshot(cx));
|
||||||
|
|||||||
Reference in New Issue
Block a user