tui: Constify functions, shrink Margin representation

This commit is contained in:
Blaž Hrastnik 2024-05-21 04:34:36 +09:00
parent e94735bbd3
commit dfcd814389
14 changed files with 102 additions and 112 deletions

View file

@ -23,7 +23,7 @@
// let size = f.size();
// let text = Text::from(SAMPLE_STRING);
// let paragraph = Paragraph::new(&text)
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .alignment(alignment)
// .wrap(Wrap { trim: true });
// f.render_widget(paragraph, size);
@ -90,7 +90,7 @@
// let size = f.size();
// let text = Text::from(s);
// let paragraph = Paragraph::new(&text)
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .wrap(Wrap { trim: true });
// f.render_widget(paragraph, size);
// })
@ -122,7 +122,7 @@
// let size = f.size();
// let text = Text::from(s);
// let paragraph = Paragraph::new(&text)
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .wrap(Wrap { trim: true });
// f.render_widget(paragraph, size);
// })
@ -156,7 +156,7 @@
// .draw(|f| {
// let size = f.size();
// let text = Text::from(line);
// let paragraph = Paragraph::new(&text).block(Block::default().borders(Borders::ALL));
// let paragraph = Paragraph::new(&text).block(Block::bordered());
// f.render_widget(paragraph, size);
// })
// .unwrap();
@ -175,7 +175,7 @@
// "段落现在可以水平滚动了!\nParagraph can scroll horizontally!\nShort line",
// );
// let paragraph = Paragraph::new(&text)
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .alignment(alignment)
// .scroll(scroll);
// f.render_widget(paragraph, size);

View file

@ -24,7 +24,7 @@
// Row::new(vec!["Row41", "Row42", "Row43"]),
// ])
// .header(Row::new(vec!["Head1", "Head2", "Head3"]).bottom_margin(1))
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .widths(&[
// Constraint::Length(5),
// Constraint::Length(5),
@ -122,7 +122,7 @@
// Row::new(vec!["Row41", "Row42", "Row43"]),
// ])
// .header(Row::new(vec!["Head1", "Head2", "Head3"]).bottom_margin(1))
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .widths(widths);
// f.render_widget(table, size);
// })
@ -210,7 +210,7 @@
// Row::new(vec!["Row41", "Row42", "Row43"]),
// ])
// .header(Row::new(vec!["Head1", "Head2", "Head3"]).bottom_margin(1))
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .widths(widths)
// .column_spacing(0);
// f.render_widget(table, size);
@ -316,7 +316,7 @@
// Row::new(vec!["Row41", "Row42", "Row43"]),
// ])
// .header(Row::new(vec!["Head1", "Head2", "Head3"]).bottom_margin(1))
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .widths(widths);
// f.render_widget(table, size);
// })
@ -425,7 +425,7 @@
// Row::new(vec!["Row41", "Row42", "Row43"]),
// ])
// .header(Row::new(vec!["Head1", "Head2", "Head3"]).bottom_margin(1))
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .widths(widths)
// .column_spacing(0);
// f.render_widget(table, size);
@ -530,7 +530,7 @@
// Row::new(vec!["Row41", "Row42", "Row43"]).height(2),
// ])
// .header(Row::new(vec!["Head1", "Head2", "Head3"]).bottom_margin(1))
// .block(Block::default().borders(Borders::ALL))
// .block(Block::bordered())
// .highlight_symbol(">> ")
// .widths(&[
// Constraint::Length(5),