mirror of
https://github.com/helix-editor/helix.git
synced 2025-04-04 11:27:46 +03:00
Avoid cloning the whole paragraph content just for rendering (#9739)
* Avoid cloning the whole paragraph content just for rendering * Fix tests
This commit is contained in:
parent
26b3dc29be
commit
00653c772e
8 changed files with 29 additions and 28 deletions
|
@ -17,14 +17,16 @@ fn terminal_buffer_size_should_not_be_limited() {
|
|||
// let backend = TestBackend::new(10, 10);
|
||||
// let mut terminal = Terminal::new(backend)?;
|
||||
// let frame = terminal.draw(|f| {
|
||||
// let paragraph = Paragraph::new("Test");
|
||||
// let text = Text::from("Test");
|
||||
// let paragraph = Paragraph::new(&text);
|
||||
// f.render_widget(paragraph, f.size());
|
||||
// })?;
|
||||
// assert_eq!(frame.buffer.get(0, 0).symbol, "T");
|
||||
// assert_eq!(frame.area, Rect::new(0, 0, 10, 10));
|
||||
// terminal.backend_mut().resize(8, 8);
|
||||
// let frame = terminal.draw(|f| {
|
||||
// let paragraph = Paragraph::new("test");
|
||||
// let text = Text::from("test");
|
||||
// let paragraph = Paragraph::new(&text);
|
||||
// f.render_widget(paragraph, f.size());
|
||||
// })?;
|
||||
// assert_eq!(frame.buffer.get(0, 0).symbol, "t");
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue