Converted project to use the tui-rs-revival ratatui in favor of the likely soon-to-be-archived tui-rs repo.
This commit is contained in:
+3
-2
@@ -1,4 +1,5 @@
|
||||
use std::iter;
|
||||
use std::rc::Rc;
|
||||
|
||||
use tui::backend::Backend;
|
||||
use tui::layout::{Alignment, Constraint, Rect};
|
||||
@@ -44,7 +45,7 @@ pub fn ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App) {
|
||||
|
||||
draw_error(f, app, chunks[1]);
|
||||
|
||||
vec![chunks[0], chunks[2], chunks[3]]
|
||||
Rc::new([chunks[0], chunks[2], chunks[3]])
|
||||
} else {
|
||||
vertical_chunks_with_margin(
|
||||
vec![
|
||||
@@ -365,7 +366,7 @@ pub fn draw_prompt_box_with_content<B: Backend>(
|
||||
|
||||
f.render_widget(content_paragraph, vertical_chunks[1]);
|
||||
|
||||
vec![vertical_chunks[0], vertical_chunks[2], vertical_chunks[3]]
|
||||
Rc::new([vertical_chunks[0], vertical_chunks[2], vertical_chunks[3]])
|
||||
} else {
|
||||
vertical_chunks_with_margin(
|
||||
vec![
|
||||
|
||||
+5
-4
@@ -1,3 +1,4 @@
|
||||
use std::rc::Rc;
|
||||
use tui::backend::Backend;
|
||||
use tui::layout::{Alignment, Constraint, Direction, Layout, Rect};
|
||||
use tui::style::{Color, Modifier, Style};
|
||||
@@ -15,7 +16,7 @@ pub const COLOR_ORANGE: Color = Color::Rgb(255, 170, 66);
|
||||
pub const COLOR_WHITE: Color = Color::White;
|
||||
pub const COLOR_MAGENTA: Color = Color::Magenta;
|
||||
|
||||
pub fn horizontal_chunks(constraints: Vec<Constraint>, area: Rect) -> Vec<Rect> {
|
||||
pub fn horizontal_chunks(constraints: Vec<Constraint>, area: Rect) -> Rc<[Rect]> {
|
||||
layout_with_constraints(constraints)
|
||||
.direction(Direction::Horizontal)
|
||||
.split(area)
|
||||
@@ -25,14 +26,14 @@ pub fn horizontal_chunks_with_margin(
|
||||
constraints: Vec<Constraint>,
|
||||
area: Rect,
|
||||
margin: u16,
|
||||
) -> Vec<Rect> {
|
||||
) -> Rc<[Rect]> {
|
||||
layout_with_constraints(constraints)
|
||||
.direction(Direction::Horizontal)
|
||||
.margin(margin)
|
||||
.split(area)
|
||||
}
|
||||
|
||||
pub fn vertical_chunks(constraints: Vec<Constraint>, area: Rect) -> Vec<Rect> {
|
||||
pub fn vertical_chunks(constraints: Vec<Constraint>, area: Rect) -> Rc<[Rect]> {
|
||||
layout_with_constraints(constraints)
|
||||
.direction(Direction::Vertical)
|
||||
.split(area)
|
||||
@@ -42,7 +43,7 @@ pub fn vertical_chunks_with_margin(
|
||||
constraints: Vec<Constraint>,
|
||||
area: Rect,
|
||||
margin: u16,
|
||||
) -> Vec<Rect> {
|
||||
) -> Rc<[Rect]> {
|
||||
layout_with_constraints(constraints)
|
||||
.direction(Direction::Vertical)
|
||||
.margin(margin)
|
||||
|
||||
Reference in New Issue
Block a user