Fix bug where all editor completions would be black (#28548)

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki
2025-04-10 17:59:10 -06:00
committed by GitHub
parent fd256d159d
commit c0262cf62f
2 changed files with 18 additions and 10 deletions
+10 -4
View File
@@ -1,10 +1,12 @@
use crate::{
ActiveTooltip, AnyView, App, Bounds, DispatchPhase, Element, ElementId, GlobalElementId,
HighlightStyle, Hitbox, IntoElement, LayoutId, MouseDownEvent, MouseMoveEvent, MouseUpEvent,
Pixels, Point, SharedString, Size, TextOverflow, TextRun, TextStyle, TooltipId, WhiteSpace,
Window, WrappedLine, WrappedLineLayout, register_tooltip_mouse_handlers, set_tooltip_on_window,
Pixels, Point, SharedString, Size, TextAlign, TextOverflow, TextRun, TextStyle,
TextStyleRefinement, TooltipId, WhiteSpace, Window, WrappedLine, WrappedLineLayout,
register_tooltip_mouse_handlers, set_tooltip_on_window,
};
use anyhow::anyhow;
use refineable::Refineable as _;
use smallvec::SmallVec;
use std::{
cell::{Cell, RefCell},
@@ -416,13 +418,17 @@ impl TextLayout {
let line_height = element_state.line_height;
let mut line_origin = bounds.origin;
let text_style = window.text_style();
// Get current text_style refinements
let mut text_style = TextStyleRefinement::default();
for style in window.text_style_stack.iter().as_ref() {
text_style.refine(&style);
}
for line in &element_state.lines {
line.paint_background(
line_origin,
line_height,
text_style.text_align,
text_style.text_align.unwrap_or(TextAlign::Left),
Some(bounds),
window,
cx,