From 770496511c67cf276f0b0a292e7a82fbd1b5f778 Mon Sep 17 00:00:00 2001 From: exp80 Date: Sat, 18 Mar 2023 17:16:40 +0100 Subject: Fix highlighting in picker with multiple columns (#6333) --- helix-term/src/ui/picker.rs | 5 ++++- helix-tui/src/text.rs | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index bc2f98ee..3294a2a1 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -812,7 +812,10 @@ impl Component for Picker { for cell in row.cells.iter_mut() { let spans = match cell.content.lines.get(0) { Some(s) => s, - None => continue, + None => { + cell_start_byte_offset += TEMP_CELL_SEP.len(); + continue; + } }; let mut cell_len = 0; diff --git a/helix-tui/src/text.rs b/helix-tui/src/text.rs index a3e242fe..076766dd 100644 --- a/helix-tui/src/text.rs +++ b/helix-tui/src/text.rs @@ -453,10 +453,12 @@ impl<'a> From<&Text<'a>> for String { let mut output = String::with_capacity(size); for spans in &text.lines { + if !output.is_empty() { + output.push('\n'); + } for span in &spans.0 { output.push_str(&span.content); } - output.push('\n'); } output } -- cgit v1.2.3-70-g09d2