fix!: remove start_corner

While is somewhat works its not used and doesnt seem that useful
This commit is contained in:
EdJoPaTo
2024-02-23 23:51:37 +01:00
parent 9e93b3ecd1
commit 85bfecc568
+5 -21
View File
@@ -11,7 +11,7 @@ The user interaction state (like the current selection) is stored in the [`TreeS
use std::collections::HashSet;
use ratatui::buffer::Buffer;
use ratatui::layout::{Corner, Rect};
use ratatui::layout::Rect;
use ratatui::style::Style;
use ratatui::widgets::{Block, StatefulWidget, Widget};
use unicode_width::UnicodeWidthStr;
@@ -64,7 +64,6 @@ pub struct Tree<'a, Identifier> {
scrollbar: Option<ratatui::widgets::Scrollbar<'a>>,
#[cfg(feature = "experimental_scrollbar")]
scrollbar_margin: ratatui::layout::Margin,
start_corner: Corner,
/// Style used as a base style for the widget
style: Style,
@@ -109,7 +108,6 @@ where
scrollbar: None,
#[cfg(feature = "experimental_scrollbar")]
scrollbar_margin: ratatui::layout::Margin::new(0, 0),
start_corner: Corner::TopLeft,
style: Style::new(),
highlight_style: Style::new(),
highlight_symbol: "",
@@ -140,12 +138,6 @@ where
self
}
#[must_use]
pub const fn start_corner(mut self, corner: Corner) -> Self {
self.start_corner = corner;
self
}
#[must_use]
pub const fn style(mut self, style: Style) -> Self {
self.style = style;
@@ -272,18 +264,10 @@ where
let has_selection = !state.selected.is_empty();
#[allow(clippy::cast_possible_truncation)]
for item in visible.iter().skip(state.offset).take(end - start) {
#[allow(clippy::single_match_else)] // Keep same as List impl
let (x, y) = match self.start_corner {
Corner::BottomLeft => {
current_height += item.item.height() as u16;
(area.left(), area.bottom() - current_height)
}
_ => {
let pos = (area.left(), area.top() + current_height);
current_height += item.item.height() as u16;
pos
}
};
let x = area.x;
let y = area.y + current_height;
current_height += item.item.height() as u16;
let area = Rect {
x,
y,