on master help sign in
Provide a single gutter component that does breakpoint || diagnostic
commit84e939ef586efe887343bb554699cd930b61c0d2 authorBlaž Hrastnik <blaz@mxxn.io> dateWed 1 Dec 2021, 00:24 (5 years ago) parentd906911
2 files changed+17−2
helix-view/src/gutter.rs+16 helix-view/src/view.rs+1−2
helix-view/src/gutter.rs+16
@@ -155,3 +155,19 @@ pub fn breakpoints<'doc>(
155155 Some(style)
156156 })
157157}
158+
159+pub fn diagnostics_or_breakpoints<'doc>(
160+ editor: &'doc Editor,
161+ doc: &'doc Document,
162+ view: &View,
163+ theme: &Theme,
164+ is_focused: bool,
165+ width: usize,
166+) -> GutterFn<'doc> {
167+ let diagnostics = diagnostic(editor, doc, view, theme, is_focused, width);
168+ let breakpoints = breakpoints(editor, doc, view, theme, is_focused, width);
169+
170+ Box::new(move |line, selected, out| {
171+ breakpoints(line, selected, out).or_else(|| diagnostics(line, selected, out))
172+ })
173+}
helix-view/src/view.rs+1−2
@@ -65,8 +65,7 @@ impl JumpList {
6565}
6666
6767const GUTTERS: &[(Gutter, usize)] = &[
68− (gutter::breakpoints, 1),
69− (gutter::diagnostic, 1),
68+ (gutter::diagnostics_or_breakpoints, 1),
7069 (gutter::line_number, 5),
7170];
7271