Render header blocks as horizontall fixed (like the gutter)

Tweak editor layout to perform horizontal autoscroll before
laying out the blocks, so that they can access the scroll position.
This commit is contained in:
Max Brunsfeld 2022-01-25 17:19:38 -08:00
parent f19934096a
commit a890787923
3 changed files with 62 additions and 69 deletions

View file

@ -692,7 +692,7 @@ fn path_header_renderer(buffer: ModelHandle<Buffer>, build_settings: BuildSettin
.left()
.contained()
.with_style(style.container)
.with_padding_left(cx.gutter_padding)
.with_padding_left(cx.gutter_padding + cx.scroll_x * cx.em_width)
.expanded()
.named("path header block")
})
@ -745,7 +745,7 @@ fn diagnostic_header_renderer(
}))
.contained()
.with_style(style.container)
.with_padding_left(cx.gutter_padding)
.with_padding_left(cx.gutter_padding + cx.scroll_x * cx.em_width)
.expanded()
.named("diagnostic header")
})
@ -757,7 +757,7 @@ fn context_header_renderer(build_settings: BuildSettings) -> RenderBlock {
let text_style = settings.style.text.clone();
Label::new("".to_string(), text_style)
.contained()
.with_padding_left(cx.gutter_padding)
.with_padding_left(cx.gutter_padding + cx.scroll_x * cx.em_width)
.named("collapsed context")
})
}
@ -1252,6 +1252,7 @@ mod tests {
.render(&BlockContext {
cx,
anchor_x: 0.,
scroll_x: 0.,
gutter_padding: 0.,
gutter_width: 0.,
line_height: 0.,