Wire through the gutter, rather than implicitly adding it

This commit is contained in:
Mikayla Maki 2023-04-21 16:12:33 -07:00
parent 23932b7e6c
commit d841c3729b

View file

@ -46,6 +46,7 @@ pub struct LayoutState {
mode: TermMode, mode: TermMode,
display_offset: usize, display_offset: usize,
hyperlink_tooltip: Option<Element<TerminalView>>, hyperlink_tooltip: Option<Element<TerminalView>>,
gutter: f32,
} }
///Helper struct for converting data between alacritty's cursor points, and displayed cursor points ///Helper struct for converting data between alacritty's cursor points, and displayed cursor points
@ -572,10 +573,14 @@ impl Drawable<TerminalView> for TerminalElement {
let text_style = TerminalElement::make_text_style(font_cache, settings); let text_style = TerminalElement::make_text_style(font_cache, settings);
let selection_color = settings.theme.editor.selection.selection; let selection_color = settings.theme.editor.selection.selection;
let match_color = settings.theme.search.match_background; let match_color = settings.theme.search.match_background;
let gutter;
let dimensions = { let dimensions = {
let line_height = text_style.font_size * settings.terminal_line_height(); let line_height = text_style.font_size * settings.terminal_line_height();
let cell_width = font_cache.em_advance(text_style.font_id, text_style.font_size); let cell_width = font_cache.em_advance(text_style.font_id, text_style.font_size);
TerminalSize::new(line_height, cell_width, constraint.max) gutter = cell_width;
let size = constraint.max - vec2f(gutter, 0.);
TerminalSize::new(line_height, cell_width, size)
}; };
let search_matches = if let Some(terminal_model) = self.terminal.upgrade(cx) { let search_matches = if let Some(terminal_model) = self.terminal.upgrade(cx) {
@ -714,6 +719,7 @@ impl Drawable<TerminalView> for TerminalElement {
mode: *mode, mode: *mode,
display_offset: *display_offset, display_offset: *display_offset,
hyperlink_tooltip, hyperlink_tooltip,
gutter,
}, },
) )
} }
@ -733,7 +739,7 @@ impl Drawable<TerminalView> for TerminalElement {
let clip_bounds = Some(visible_bounds); let clip_bounds = Some(visible_bounds);
scene.paint_layer(clip_bounds, |scene| { scene.paint_layer(clip_bounds, |scene| {
let origin = bounds.origin() + vec2f(layout.size.cell_width, 0.); let origin = bounds.origin() + vec2f(layout.gutter, 0.);
// Elements are ephemeral, only at paint time do we know what could be clicked by a mouse // Elements are ephemeral, only at paint time do we know what could be clicked by a mouse
self.attach_mouse_handlers(scene, origin, visible_bounds, layout.mode, cx); self.attach_mouse_handlers(scene, origin, visible_bounds, layout.mode, cx);