refactor: rearrange selection_spacing code (#1540)

This commit is contained in:
raylu
2024-12-03 00:11:47 -08:00
committed by GitHub
parent 4f0a8b21af
commit 7c8573f575
2 changed files with 11 additions and 11 deletions

View File

@@ -753,7 +753,7 @@ fn render_spans(spans: &[Span], mut area: Rect, buf: &mut Buffer, span_skip_widt
}
}
/// Returns an iterator over the spans that lie after a given skip widtch from the start of the
/// Returns an iterator over the spans that lie after a given skip width from the start of the
/// `Line` (including a partially visible span if the `skip_width` lands within a span).
fn spans_after_width<'a>(
spans: &'a [Span],

View File

@@ -107,16 +107,16 @@ impl StatefulWidget for &List<'_> {
};
Widget::render(&item.content, item_area, buf);
for j in 0..item.content.height() {
// if the item is selected, we need to display the highlight symbol:
// - either for the first line of the item only,
// - or for each line of the item if the appropriate option is set
let symbol = if is_selected && (j == 0 || self.repeat_highlight_symbol) {
highlight_symbol
} else {
&blank_symbol
};
if selection_spacing {
if selection_spacing {
for j in 0..item.content.height() {
// if the item is selected, we need to display the highlight symbol:
// - either for the first line of the item only,
// - or for each line of the item if the appropriate option is set
let symbol = if is_selected && (j == 0 || self.repeat_highlight_symbol) {
highlight_symbol
} else {
&blank_symbol
};
buf.set_stringn(
x,
y + j as u16,