(8020e48) Quote a comment behind a gutter bar that survives wrapping, and bump to 0.32.4
This commit is contained in:
+45
@@ -2552,6 +2552,51 @@ impl Cell {
|
||||
}
|
||||
}
|
||||
|
||||
/// The bar a quoted run draws behind, the way quoted text is drawn.
|
||||
///
|
||||
/// Box-drawing vertical, the family the rule under HISTORY is already rendered from, so
|
||||
/// it shows wherever that does. One cell wide, grey, and clear of the two vocabularies
|
||||
/// it sits among: the priority meter owns the circles and the dot and the relation rows
|
||||
/// own the cross and the arrows, so nothing here may read as a level or as an edge.
|
||||
/// Grey is the colour chrome takes everywhere else, which names its row rather than
|
||||
/// holding a value — what a quote bar does. It lives beside [`Cell`] rather than in
|
||||
/// `history.rs`, because the CLI prefixes stored lines with it while the board paints it
|
||||
/// as a gutter column, and a glyph two renderers draw is a glyph the palette owns.
|
||||
pub const QUOTE_BAR: &str = "\u{2502}";
|
||||
|
||||
/// One run of text behind [`QUOTE_BAR`], every stored line of it.
|
||||
///
|
||||
/// This is the CLI's shape of a quote: the bar rides on each line's first characters,
|
||||
/// and a line the terminal soft-wraps continues without one, because a pipe has no width
|
||||
/// to honour. The board quotes the same runs as geometry instead — a gutter column the
|
||||
/// bar fills top to bottom — which is what keeps a wrapped row under the mark there.
|
||||
/// With colour off the glyph goes but the width it occupied stays, as plain spaces
|
||||
/// derived from the drawn form rather than spelled beside it, so a piped `show` keeps
|
||||
/// every line at the same column without carrying an escape byte.
|
||||
pub fn quoted_cells(body: &str, colored: bool) -> Vec<Cell> {
|
||||
let bar = format!("{QUOTE_BAR} ");
|
||||
let indent = " ".repeat(bar.chars().count());
|
||||
|
||||
let mut cells = Vec::new();
|
||||
for (at, line) in body.split('\n').enumerate() {
|
||||
if at > 0 {
|
||||
cells.push(Cell::plain("\n"));
|
||||
}
|
||||
match (colored, line.is_empty()) {
|
||||
// A paragraph break draws the bar alone rather than carrying a gap into
|
||||
// nothing, which is what keeps it visibly inside the run.
|
||||
(true, true) => cells.push(Cell::colored(QUOTE_BAR, Color::Grey)),
|
||||
(true, false) => {
|
||||
cells.push(Cell::colored(&bar, Color::Grey));
|
||||
cells.push(Cell::plain(line));
|
||||
}
|
||||
(false, false) => cells.push(Cell::plain(format!("{indent}{line}"))),
|
||||
(false, true) => {}
|
||||
}
|
||||
}
|
||||
cells
|
||||
}
|
||||
|
||||
/// The relations of one ticket, both directions, in the order they are shown.
|
||||
///
|
||||
/// Stored first: the relations the ticket holds, then the ones held against it, named
|
||||
|
||||
Reference in New Issue
Block a user