Increase diagnostic editor's vertical scroll margin

This way, the first path header will always be fully visible when
you move your cursor to the beginning of the multibuffer.
This commit is contained in:
Max Brunsfeld 2022-01-25 17:35:37 -08:00
parent 9b9fcf6927
commit 76bbd101c6
2 changed files with 13 additions and 3 deletions

View file

@ -146,8 +146,11 @@ impl ProjectDiagnosticsEditor {
let excerpts = cx.add_model(|cx| MultiBuffer::new(project.read(cx).replica_id()));
let build_settings = editor::settings_builder(excerpts.downgrade(), settings.clone());
let editor =
cx.add_view(|cx| Editor::for_buffer(excerpts.clone(), build_settings.clone(), cx));
let editor = cx.add_view(|cx| {
let mut editor = Editor::for_buffer(excerpts.clone(), build_settings.clone(), cx);
editor.set_vertical_scroll_margin(5, cx);
editor
});
cx.subscribe(&editor, |_, _, event, cx| cx.emit(*event))
.detach();