Apply cursor styles during paint

This makes the editor's cursor an IBeam and properly deals with nested cursor styles.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo
2022-04-22 10:54:18 -06:00
co-authored by Antonio Scandurra
parent 53bf7b61c0
commit 92f040df00
16 changed files with 124 additions and 96 deletions
+2
View File
@@ -16,6 +16,7 @@ use gpui::{
PathBuilder,
},
json::{self, ToJson},
platform::CursorStyle,
text_layout::{self, Line, RunStyle, TextLayoutCache},
AppContext, Axis, Border, Element, ElementBox, Event, EventContext, LayoutContext,
MutableAppContext, PaintContext, Quad, Scene, SizeConstraint, ViewContext, WeakViewHandle,
@@ -329,6 +330,7 @@ impl EditorElement {
let content_origin = bounds.origin() + vec2f(layout.gutter_margin, 0.);
cx.scene.push_layer(Some(bounds));
cx.scene.push_cursor_style(bounds, CursorStyle::IBeam);
for (range, color) in &layout.highlighted_ranges {
self.paint_highlighted_range(