diff options
author | Mo | 2024-02-27 17:24:05 +0000 |
---|---|---|
committer | GitHub | 2024-02-27 17:24:05 +0000 |
commit | 00653c772e7df6f68071d1cb1c92bfe9ca4876f9 (patch) | |
tree | ab89132d7fc7d174216264bd367942e9589b2269 /helix-tui/tests/widgets_paragraph.rs | |
parent | 26b3dc29be886c5a2ed1a5caaaf09eb730829c3e (diff) |
Avoid cloning the whole paragraph content just for rendering (#9739)
* Avoid cloning the whole paragraph content just for rendering
* Fix tests
Diffstat (limited to 'helix-tui/tests/widgets_paragraph.rs')
-rw-r--r-- | helix-tui/tests/widgets_paragraph.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/helix-tui/tests/widgets_paragraph.rs b/helix-tui/tests/widgets_paragraph.rs index a7c972eb..3d2ac467 100644 --- a/helix-tui/tests/widgets_paragraph.rs +++ b/helix-tui/tests/widgets_paragraph.rs @@ -21,8 +21,8 @@ // terminal // .draw(|f| { // let size = f.size(); -// let text = vec![Spans::from(SAMPLE_STRING)]; -// let paragraph = Paragraph::new(text) +// let text = Text::from(SAMPLE_STRING); +// let paragraph = Paragraph::new(&text) // .block(Block::default().borders(Borders::ALL)) // .alignment(alignment) // .wrap(Wrap { trim: true }); @@ -88,8 +88,8 @@ // terminal // .draw(|f| { // let size = f.size(); -// let text = vec![Spans::from(s)]; -// let paragraph = Paragraph::new(text) +// let text = Text::from(s); +// let paragraph = Paragraph::new(&text) // .block(Block::default().borders(Borders::ALL)) // .wrap(Wrap { trim: true }); // f.render_widget(paragraph, size); @@ -120,8 +120,8 @@ // terminal // .draw(|f| { // let size = f.size(); -// let text = vec![Spans::from(s)]; -// let paragraph = Paragraph::new(text) +// let text = Text::from(s); +// let paragraph = Paragraph::new(&text) // .block(Block::default().borders(Borders::ALL)) // .wrap(Wrap { trim: true }); // f.render_widget(paragraph, size); @@ -155,8 +155,8 @@ // terminal // .draw(|f| { // let size = f.size(); - -// let paragraph = Paragraph::new(line).block(Block::default().borders(Borders::ALL)); +// let text = Text::from(line); +// let paragraph = Paragraph::new(&text).block(Block::default().borders(Borders::ALL)); // f.render_widget(paragraph, size); // }) // .unwrap(); @@ -174,7 +174,7 @@ // let text = Text::from( // "段落现在可以水平滚动了!\nParagraph can scroll horizontally!\nShort line", // ); -// let paragraph = Paragraph::new(text) +// let paragraph = Paragraph::new(&text) // .block(Block::default().borders(Borders::ALL)) // .alignment(alignment) // .scroll(scroll); |