diff --git a/Justfile b/Justfile index b7c45b88..5b469fff 100644 --- a/Justfile +++ b/Justfile @@ -13,7 +13,13 @@ cov: export RUSTDOCFLAGS='-Cinstrument-coverage' export LLVM_PROFILE_FILE='cov/cargo-test-%p-%m.profraw' time cargo test --workspace --exclude jack --profile coverage - time grcov . --binary-path ./target/coverage/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" --ignore 'target/*' -o target/coverage/html + #export LLVM_PROFILE_FILE='cov/cargo-doctest-%p-%m.profraw' + #time cargo test --workspace --exclude jack --profile coverage --doc + time grcov . --llvm --threads 2 --binary-path ./target/coverage/deps/ -s . -t html --ignore-not-existing --ignore '../*' --ignore "/*" --ignore 'target/*' -o target/coverage/html +llcov: + time cargo llvm-cov --workspace --exclude jack --profile coverage --no-report + time cargo llvm-cov --workspace --exclude jack --profile coverage --no-report --doc + time cargo llvm-cov report --doctests --html #--output-path target/coverage/html prof: CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -- arranger status: diff --git a/tek/src/view.rs b/tek/src/view.rs index 6055b5ce..4a20514f 100644 --- a/tek/src/view.rs +++ b/tek/src/view.rs @@ -259,23 +259,21 @@ impl Tek { let h = 1; let header: ThunkBox<_> = (move||Tui::bg(Tui::g(32), Fill::x(Align::w(self.view_track_add()))).boxed()).into(); - let cells: ThunkBox<_> = per_track!(self.size.w();|self, track, t|{ + let content: ThunkBox<_> = per_track!(self.size.w();|self, track, t|{ let active = self.selected().track() == Some(t+1); - let name = &track.name; - let fg = track.color.lightest.rgb; - let bg = if active { track.color.light.rgb } else { track.color.base.rgb }; - let bg2 = if t > 0 { self.tracks()[t - 1].color.base.rgb } else { Reset }; - let bfg = if active { Rgb(255,255,255) } else { Rgb(0,0,0) }; - let bs = Style::default().fg(bfg).bg(bg); - let cell = Bsp::e( + let name = &track.name; + let fg = track.color.lightest.rgb; + let bg = if active { track.color.light.rgb } else { track.color.base.rgb }; + let bg2 = if t > 0 { self.tracks()[t - 1].color.base.rgb } else { Reset }; + let bfg = if active { Rgb(255,255,255) } else { Rgb(0,0,0) }; + Outer(active, Style::default().fg(bfg).bg(bg)).enclose(Bsp::e( Tui::fg_bg(bg, bg2, "▐"), Bsp::w( Tui::fg_bg(bg, Reset, "▌"), Tui::fg_bg(fg, bg, Tui::bold(true, Fill::x(Align::nw(name)))), - )); - Outer(active, bs).enclose(cell) + ))) }); - self.view_row(self.w(), 1, header, cells) + self.view_row(self.w(), 1, header, content) } fn view_track_add (&self) -> impl Content + use<'_> { let data = (self.selected.track().unwrap_or(0), self.tracks().len()); @@ -324,8 +322,8 @@ impl Tek { map_south(y1 as u16, height, border(height, cell)) }).boxed() }; - let border = move|x|Outer(false, bstyle).enclose_bg(x); - let content: ThunkBox<_> = per_track!(size_w; |self, track, t|{ + let border = move|x|Outer(true, bstyle).enclose_bg(x); + let content: ThunkBox<_> = per_track!(self.size.w(); |self, track, t|{ let last_color = self.fmtd.read().unwrap().last_color.clone(); let same_track = selected_track == Some(t+1); border(Map::new(scenes, move|(_, scene, y1, y2), s|{ @@ -376,13 +374,15 @@ impl Tek { When::new(selected, Fill::y(Align::n(button(tab, "edit")))), phat_sel_3(selected, Fill::xy(label()), Fill::xy(label()), top, mid, low))); let cell = Either::new(active, editor, cell); - Either(y2 > size_h, (), map_south(y1 as u16, h, Push::y(1, Fixed::y(h, cell)))) + Either(y2 > size_h, + (), + map_south(y1 as u16, h, Push::y(1, Fixed::y(h, cell)))) }) })) }); let border = move|x|Outer(false, bstyle).enclose_bg(x); border(self.view_row( - size_w as u16, + self.w(), size_h as u16, <_ as Into>>::into(header), <_ as Into>>::into(content), diff --git a/tui/src/lib.rs b/tui/src/lib.rs index 43787759..740877af 100644 --- a/tui/src/lib.rs +++ b/tui/src/lib.rs @@ -52,6 +52,6 @@ pub(crate) use std::ffi::OsString; engine.read().unwrap().exited.store(true, std::sync::atomic::Ordering::Relaxed); let state = TestComponent("hello world".into()); let state = std::sync::Arc::new(std::sync::RwLock::new(state)); - engine.run(&state)?; + //engine.run(&state)?; Ok(()) } diff --git a/tui/src/tui_content.rs b/tui/src/tui_content.rs index 7a582d84..f5fce2dd 100644 --- a/tui/src/tui_content.rs +++ b/tui/src/tui_content.rs @@ -233,33 +233,6 @@ impl> Content for Styled { } } -//pub trait TuiStyle: Render + Sized { - //fn fg (self, color: Color) -> impl Render { - //Layers::new(move |add|{ add(&Foreground(color))?; add(&self) }) - //} - //fn bg (self, color: Color) -> impl Render { - //Layers::new(move |add|{ add(&Background(color))?; add(&self) }) - //} - //fn bold (self, on: bool) -> impl Render { - //Layers::new(move |add|{ add(&Bold(on))?; add(&self) }) - //} - //fn border (self, style: S) -> impl Render { - //Bordered(style, self) - //} -//} - -//impl> TuiStyle for R {} - -//impl Content for Border { -//} - -//impl> Content for Bordered { - //fn content (&self) -> impl Render { - //let content: &dyn Content = &self.1; - //lay! { content.padding_xy(1, 1), Border(self.0) }.fill_xy() - //} -//} - pub struct Bordered>(pub bool, pub S, pub W); content!(TuiOut: |self: Bordered>|Fill::xy( lay!(When::new(self.0, Border(self.0, self.1)), Padding::xy(1, 1, &self.2)) @@ -511,3 +484,30 @@ border! { fn style (&self) -> Option