mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-24 05:33:25 +00:00
fix: add ansi_buffer example
This commit is contained in:
parent
ee85bcfb43
commit
48924e9cb9
2 changed files with 10 additions and 2 deletions
|
@ -182,8 +182,8 @@ harness = false
|
|||
|
||||
|
||||
[[example]]
|
||||
name = "barchart"
|
||||
required-features = ["crossterm"]
|
||||
name = "ansi_buffer"
|
||||
required-features = ["unstable-widget-ext", "unstable-widget-ref"]
|
||||
doc-scrape-examples = true
|
||||
|
||||
[[example]]
|
||||
|
|
8
examples/ansi_buffer.rs
Normal file
8
examples/ansi_buffer.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
use ratatui::{prelude::*, widgets::ansi_string_buffer::AnsiStringBuffer};
|
||||
|
||||
fn main() {
|
||||
let mut buf = AnsiStringBuffer::new(5, 2);
|
||||
buf.render_ref(&Line::styled("Hello", Color::Blue), Rect::new(0, 0, 5, 1));
|
||||
buf.render_ref(&Line::styled("World", Color::Green), Rect::new(0, 1, 5, 1));
|
||||
println!("{buf}");
|
||||
}
|
Loading…
Reference in a new issue