fix: Render continuation between no source labels

This commit is contained in:
Scott Schafer
2025-07-22 05:14:37 -06:00
parent 93d16c5100
commit 2bd47d2646
2 changed files with 21 additions and 20 deletions

View File

@@ -1671,23 +1671,27 @@ impl HumanEmitter {
{ {
code_window_status = CodeWindowStatus::Closed; code_window_status = CodeWindowStatus::Closed;
} }
for (label, is_primary) in labels.into_iter() { let labels_len = labels.len();
for (label_idx, (label, is_primary)) in labels.into_iter().enumerate() {
let style = if is_primary { let style = if is_primary {
Style::LabelPrimary Style::LabelPrimary
} else { } else {
Style::LabelSecondary Style::LabelSecondary
}; };
let pipe = self.col_separator(); self.draw_col_separator_no_space(
buffer.prepend(line_idx, &format!(" {pipe}"), Style::LineNumber); &mut buffer,
for _ in 0..max_line_num_len { line_idx,
buffer.prepend(line_idx, " ", Style::NoStyle); max_line_num_len + 1,
} );
line_idx += 1; line_idx += 1;
let chr = self.note_separator(); self.draw_note_separator(
buffer.append(line_idx, &format!(" {chr} note: "), style); &mut buffer,
for _ in 0..max_line_num_len { line_idx,
buffer.prepend(line_idx, " ", Style::NoStyle); max_line_num_len + 1,
} label_idx != labels_len - 1,
);
buffer.append(line_idx, "note", Style::MainHeaderMsg);
buffer.append(line_idx, ": ", Style::NoStyle);
buffer.append(line_idx, label, style); buffer.append(line_idx, label, style);
line_idx += 1; line_idx += 1;
} }
@@ -2863,10 +2867,11 @@ impl HumanEmitter {
} }
} }
fn note_separator(&self) -> char { fn note_separator(&self, is_cont: bool) -> &'static str {
match self.theme { match self.theme {
OutputTheme::Ascii => '=', OutputTheme::Ascii => "= ",
OutputTheme::Unicode => '╰', OutputTheme::Unicode if is_cont => "",
OutputTheme::Unicode => "",
} }
} }
@@ -2979,11 +2984,7 @@ impl HumanEmitter {
col: usize, col: usize,
is_cont: bool, is_cont: bool,
) { ) {
let chr = match self.theme { let chr = self.note_separator(is_cont);
OutputTheme::Ascii => "= ",
OutputTheme::Unicode if is_cont => "",
OutputTheme::Unicode => "",
};
buffer.puts(line, col, chr, Style::LineNumber); buffer.puts(line, col, chr, Style::LineNumber);
} }

View File

@@ -34,7 +34,7 @@ LL │ wtf: Some(Box(U {
note: constructor is not visible here due to private fields note: constructor is not visible here due to private fields
╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL
note: private field note: private field
╰ note: private field ╰ note: private field
help: you might have meant to use an associated function to build this type help: you might have meant to use an associated function to build this type