Introduce CursorRegion struct

This will blend in with an upcoming MouseRegion struct that sits next to it in the scene.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo
2022-05-26 11:00:10 -06:00
co-authored by Antonio Scandurra
parent f4d13ef596
commit 0866f0ed55
6 changed files with 44 additions and 24 deletions
+7 -3
View File
@@ -18,8 +18,9 @@ use gpui::{
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,
AppContext, Axis, Border, CursorRegion, Element, ElementBox, Event, EventContext,
LayoutContext, MutableAppContext, PaintContext, Quad, Scene, SizeConstraint, ViewContext,
WeakViewHandle,
};
use json::json;
use language::{Bias, DiagnosticSeverity};
@@ -330,7 +331,10 @@ 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);
cx.scene.push_cursor_region(CursorRegion {
bounds,
style: CursorStyle::IBeam,
});
for (range, color) in &layout.highlighted_ranges {
self.paint_highlighted_range(