refactor: rearrange selection_spacing code (#1540)
This commit is contained in:
@@ -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],
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user