diff options
author | Blaž Hrastnik | 2021-11-30 15:24:45 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-11-30 15:24:45 +0000 |
commit | 84e939ef586efe887343bb554699cd930b61c0d2 (patch) | |
tree | 0e6c94fa037b699aaa7858803518adb97c77e885 /helix-view/src/gutter.rs | |
parent | d906911417478fe98900730db856e3a7dffe6ea0 (diff) |
Provide a single gutter component that does breakpoint || diagnostic
Diffstat (limited to 'helix-view/src/gutter.rs')
-rw-r--r-- | helix-view/src/gutter.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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)) + }) +} |