From 84e939ef586efe887343bb554699cd930b61c0d2 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Wed, 1 Dec 2021 00:24:45 +0900 Subject: Provide a single gutter component that does breakpoint || diagnostic --- helix-view/src/gutter.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'helix-view/src/gutter.rs') diff --git a/helix-view/src/gutter.rs b/helix-view/src/gutter.rs index 1ee84d43..7bc8d375 100644 --- a/helix-view/src/gutter.rs +++ b/helix-view/src/gutter.rs @@ -155,3 +155,19 @@ pub fn breakpoints<'doc>( Some(style) }) } + +pub fn diagnostics_or_breakpoints<'doc>( + editor: &'doc Editor, + doc: &'doc Document, + view: &View, + theme: &Theme, + is_focused: bool, + width: usize, +) -> GutterFn<'doc> { + let diagnostics = diagnostic(editor, doc, view, theme, is_focused, width); + let breakpoints = breakpoints(editor, doc, view, theme, is_focused, width); + + Box::new(move |line, selected, out| { + breakpoints(line, selected, out).or_else(|| diagnostics(line, selected, out)) + }) +} -- cgit v1.2.3-70-g09d2