feat: Add word wrap to preview window

This commit is contained in:
Liam 2024-08-26 10:48:29 -07:00
parent 1417ed73b2
commit e9db67b2fa
No known key found for this signature in database

View File

@ -68,8 +68,15 @@ impl FloatContent for FloatingText {
.text
.iter()
.skip(self.scroll)
.flat_map(|line| {
line.chars()
.collect::<Vec<char>>()
.chunks(inner_area.width as usize)
.map(|chunk| chunk.iter().collect())
.collect::<Vec<String>>()
})
.take(inner_area.height as usize)
.map(|line| Line::from(line.as_str()))
.map(Line::from)
.collect();
// Create list widget