| 
1 | 1 | use crate::{  | 
2 | 2 |     config::HighlightLine,  | 
3 | 3 |     edges::{edge::Edge, padding::Padding},  | 
4 |  | -    utils::color::RgbaColor,  | 
 | 4 | +    snapshot::image_snapshot::DEFAULT_WINDOW_MIN_WIDTH,  | 
 | 5 | +    utils::{code::min_width, color::RgbaColor},  | 
5 | 6 | };  | 
6 | 7 | 
 
  | 
7 | 8 | use super::{  | 
8 | 9 |     editor::code::CODE_LINE_HEIGHT,  | 
9 | 10 |     interface::{  | 
10 |  | -        component::{Component, ComponentContext, RenderParams},  | 
 | 11 | +        component::{query_style, Component, ComponentContext, RenderParams},  | 
11 | 12 |         style::ComponentStyle,  | 
12 | 13 |     },  | 
13 | 14 | };  | 
@@ -102,14 +103,15 @@ impl HighlightCodeBlock {  | 
102 | 103 |             );  | 
103 | 104 |         }  | 
104 | 105 | 
 
  | 
 | 106 | +        let editor_style = query_style("RectInnerLayer").unwrap();  | 
105 | 107 |         let end_line_number = end_line_number.min(self.code_line_count as u32);  | 
106 | 108 |         let mut paint = Paint::default();  | 
107 | 109 |         // If the start line number is start at n, the y offset should be (n - 1) * line_height  | 
108 | 110 |         let start_y_offset = (start_line_number - 1) as f32 * CODE_LINE_HEIGHT;  | 
109 | 111 |         let rect = Rect::from_xywh(  | 
110 | 112 |             render_params.x - self.editor_padding.left,  | 
111 | 113 |             render_params.y + start_y_offset,  | 
112 |  | -            parent_style.width + self.editor_padding.horizontal(),  | 
 | 114 | +            editor_style.width,  | 
113 | 115 |             // If end_line_number is equal to start_line_number, the height should be line_height  | 
114 | 116 |             (end_line_number - start_line_number + 1) as f32 * CODE_LINE_HEIGHT,  | 
115 | 117 |         )  | 
 | 
0 commit comments