mirror of
https://github.com/ratatui/ratatui.git
synced 2025-09-30 22:41:44 +00:00
style(paragraph): add documentation for "scroll"'s "offset" (#355)
* style(paragraph): add documentation for "scroll"'s "offset" * style(paragraph): add more text to the scroll doc-comment
This commit is contained in:
parent
b6b2da5eb7
commit
ab5e616635
@ -91,6 +91,9 @@ pub struct Wrap {
|
|||||||
pub trim: bool,
|
pub trim: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Horizontal = u16;
|
||||||
|
type Vertical = u16;
|
||||||
|
|
||||||
impl<'a> Paragraph<'a> {
|
impl<'a> Paragraph<'a> {
|
||||||
pub fn new<T>(text: T) -> Paragraph<'a>
|
pub fn new<T>(text: T) -> Paragraph<'a>
|
||||||
where
|
where
|
||||||
@ -121,7 +124,13 @@ impl<'a> Paragraph<'a> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn scroll(mut self, offset: (u16, u16)) -> Paragraph<'a> {
|
/// Set the scroll offset for the given paragraph
|
||||||
|
///
|
||||||
|
/// Scroll works by starting to render at the given offset, which unlike other scroll function
|
||||||
|
/// is (y, x)
|
||||||
|
///
|
||||||
|
/// There is a RFC for scroll refactoring and unification, see https://github.com/ratatui-org/ratatui/issues/174
|
||||||
|
pub fn scroll(mut self, offset: (Vertical, Horizontal)) -> Paragraph<'a> {
|
||||||
self.scroll = offset;
|
self.scroll = offset;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user