diff options
author | Gokul Soumya | 2022-12-24 11:21:38 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-01-18 05:19:32 +0000 |
commit | b2837ff3bea286ce7ccfba9b6fbcd861977caf83 (patch) | |
tree | 2dad402d6dcd21b4c1592c41aa079f4b02dc2c05 /helix-term/src | |
parent | 7a76c6cbbaf851d63cb4ca4be07c5d4c67afbbb2 (diff) |
Minimize allocation when converting table rows to string
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/ui/picker.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index e00fe1f8..05738ccf 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -733,7 +733,11 @@ impl<T: Item + 'static> Component for Picker<T> { .map(|mut row| { const TEMP_CELL_SEP: &str = " "; - let line = row.cell_text().join(TEMP_CELL_SEP); + let line = row.cell_text().fold(String::new(), |mut s, frag| { + s.push_str(&frag); + s.push_str(TEMP_CELL_SEP); + s + }); // Items are filtered by using the text returned by menu::Item::filter_text // but we do highlighting here using the text in Row and therefore there |