Skip to content

Commit 6437247

Browse files
committed
docs: update readme
1 parent 9591f2f commit 6437247

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

tui-box-text/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tui-box-text"
33
description = "A Ratatui widget for displaying text using the box drawing characters"
4-
version = "0.1.0"
4+
version = "0.1.1"
55
authors.workspace = true
66
license.workspace = true
77
repository.workspace = true

tui-box-text/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
A WIP Ratatui widget for drawing text using line drawing characters.
44

5-
![Demo](https://vhs.charm.sh/vhs-1iSwNZsVbPPi3kToemhLz1.gif)
5+
![Demo](https://vhs.charm.sh/vhs-6ldj2r9v3mIaSzk8H7Jp8t.gif)

tui-box-text/examples/box_text.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use std::iter::zip;
33
use color_eyre::eyre::Ok;
44
use ratatui::{
55
crossterm::event::{self, Event, KeyCode, KeyEventKind},
6-
layout::Rect,
6+
layout::{Constraint, Layout, Rect},
7+
text::Line,
78
DefaultTerminal, Frame,
89
};
910
use tui_box_text::BoxChar;
@@ -30,10 +31,15 @@ fn run(mut terminal: DefaultTerminal) -> color_eyre::Result<()> {
3031
}
3132

3233
fn draw(frame: &mut Frame) {
33-
let area = frame.area();
34+
let layout = Layout::vertical([Constraint::Length(1), Constraint::Fill(1)]);
35+
let [header, body] = layout.areas(frame.area());
36+
frame.render_widget(
37+
Line::from("Tui-box-text. Press Esc to exit").centered(),
38+
header,
39+
);
3440
let mut areas = Vec::new();
35-
for y in (area.top() + 3..area.bottom()).step_by(3) {
36-
for x in (area.left() + 4..area.right()).step_by(4) {
41+
for y in (body.top() + 3..body.bottom()).step_by(3) {
42+
for x in (body.left() + 4..body.right()).step_by(4) {
3743
areas.push(Rect::new(x - 4, y - 3, 4, 3));
3844
}
3945
}

tui-box-text/examples/box_text.tape

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Output "target/box_text.gif"
33
Set Theme "Aardvark Blue"
44
Set Width 1890
5-
Set Height 420
5+
Set Height 450
66
Hide
77
Type@0 "cargo run -p tui-box-text --example box_text --quiet"
88
Enter

0 commit comments

Comments
 (0)