pub struct ScrollableTextWidget { /* private fields */ }
Expand description
A unified widget for displaying scrollable text content. This eliminates code duplication across LooseObjectWidget, PackIndexWidget, and PackObjectWidget.
Implementations§
Source§impl ScrollableTextWidget
impl ScrollableTextWidget
Sourcepub fn text(&self) -> Text<'static>
pub fn text(&self) -> Text<'static>
Get the cached text content, or return a default if not set
Sourcepub fn scroll_down(&mut self)
pub fn scroll_down(&mut self)
Scroll down by one line
Sourcepub fn scroll_to_top(&mut self)
pub fn scroll_to_top(&mut self)
Scroll to the top of the content
Sourcepub fn scroll_to_bottom(&mut self)
pub fn scroll_to_bottom(&mut self)
Scroll to the bottom of the content
Sourcepub fn scroll_position(&self) -> usize
pub fn scroll_position(&self) -> usize
Get the current scroll position
Sourcepub fn render(
&mut self,
f: &mut Frame<'_>,
area: Rect,
title: &str,
is_focused: bool,
)
pub fn render( &mut self, f: &mut Frame<'_>, area: Rect, title: &str, is_focused: bool, )
Render the widget with scrollbar
Sourcepub fn has_content(&self) -> bool
pub fn has_content(&self) -> bool
Check if the widget has content
Trait Implementations§
Source§impl Clone for ScrollableTextWidget
impl Clone for ScrollableTextWidget
Source§fn clone(&self) -> ScrollableTextWidget
fn clone(&self) -> ScrollableTextWidget
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ScrollableTextWidget
impl Debug for ScrollableTextWidget
Auto Trait Implementations§
impl Freeze for ScrollableTextWidget
impl RefUnwindSafe for ScrollableTextWidget
impl Send for ScrollableTextWidget
impl Sync for ScrollableTextWidget
impl Unpin for ScrollableTextWidget
impl UnwindSafe for ScrollableTextWidget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more