mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 13:22:28 +00:00
Merge pull request #202 from lj3954/preview_word_wrap
feat: Add word wrap to preview window
This commit is contained in:
commit
17f9f721af
|
@ -68,8 +68,18 @@ impl FloatContent for FloatingText {
|
|||
.text
|
||||
.iter()
|
||||
.skip(self.scroll)
|
||||
.flat_map(|line| {
|
||||
if line.is_empty() {
|
||||
return vec![String::new()];
|
||||
}
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user