pub struct TextBuffer { /* private fields */ }Expand description
A Buffer paired with a text-width policy.
Construct one with new, choose the width policy with
with_width_mode /
with_eaw_wide, paint with the
TextSurface/SurfaceMut methods, then serialize with the
Encode trait.
Implementations§
Source§impl TextBuffer
impl TextBuffer
Sourcepub fn new(width: u16, height: u16) -> Self
pub fn new(width: u16, height: u16) -> Self
Create a width by height text buffer of blank cells.
The width policy defaults to WidthMode::Wc with East-Asian
Ambiguous characters measured as one cell.
Sourcepub fn with_width_mode(self, mode: WidthMode) -> Self
pub fn with_width_mode(self, mode: WidthMode) -> Self
Set the grapheme-cluster width policy and return the updated buffer.
Sourcepub fn with_eaw_wide(self, eaw_wide: bool) -> Self
pub fn with_eaw_wide(self, eaw_wide: bool) -> Self
Set the East-Asian Ambiguous policy and return the updated buffer.
When true, code points whose East-Asian-Width property is
Ambiguous are measured as two cells instead of one.
Sourcepub fn set_width_mode(&mut self, mode: WidthMode)
pub fn set_width_mode(&mut self, mode: WidthMode)
Set the grapheme-cluster width policy in place.
Sourcepub fn set_eaw_wide(&mut self, eaw_wide: bool)
pub fn set_eaw_wide(&mut self, eaw_wide: bool)
Set the East-Asian Ambiguous policy in place.
Sourcepub fn resize(&mut self, width: u16, height: u16)
pub fn resize(&mut self, width: u16, height: u16)
Resize the buffer, preserving overlapping cells.
Sourcepub fn buffer_mut(&mut self) -> &mut Buffer
pub fn buffer_mut(&mut self) -> &mut Buffer
Mutably borrow the underlying Buffer.
Sourcepub fn into_buffer(self) -> Buffer
pub fn into_buffer(self) -> Buffer
Consume the text buffer and return the underlying Buffer.
Trait Implementations§
Source§impl Bounded for TextBuffer
impl Bounded for TextBuffer
Source§impl Clone for TextBuffer
impl Clone for TextBuffer
Source§fn clone(&self) -> TextBuffer
fn clone(&self) -> TextBuffer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TextBuffer
impl Debug for TextBuffer
Source§impl Surface for TextBuffer
impl Surface for TextBuffer
Source§impl SurfaceMut for TextBuffer
impl SurfaceMut for TextBuffer
Source§fn set_cell(&mut self, pos: Position, cell: &Cell)
fn set_cell(&mut self, pos: Position, cell: &Cell)
cell at pos. Implementations are responsible for
wide-cell semantics (continuation markers, blanking covered
cells) and any dirty tracking they care to do. Taking &Cell
lets implementations skip the clone when the destination
already matches. Read moreSource§fn clear(&mut self)
fn clear(&mut self)
Cell::BLANK. Read moreSource§fn clear_rect(&mut self, rect: Rect)
fn clear_rect(&mut self, rect: Rect)
Cell::BLANK. Read moreSource§fn insert_lines(&mut self, y: u16, n: u16, bounds_bottom: u16, fill: &Cell)
fn insert_lines(&mut self, y: u16, n: u16, bounds_bottom: u16, fill: &Cell)
n blank rows at y, pushing existing rows down within
[y, bounds_bottom). Rows pushed past bounds_bottom are lost.
Freed top rows are filled with fill. Read moreSource§fn delete_lines(&mut self, y: u16, n: u16, bounds_bottom: u16, fill: &Cell)
fn delete_lines(&mut self, y: u16, n: u16, bounds_bottom: u16, fill: &Cell)
n rows at y, pulling existing rows up within
[y, bounds_bottom). The bottom n rows of the window are
filled with fill. Read moreSource§impl TextSurface for TextBuffer
impl TextSurface for TextBuffer
Source§fn width_mode(&self) -> WidthMode
fn width_mode(&self) -> WidthMode
Source§fn eaw_wide(&self) -> bool
fn eaw_wide(&self) -> bool
Source§fn set_str(
&mut self,
pos: impl Into<Position>,
s: &str,
style: impl Into<Style>,
) -> Position
fn set_str( &mut self, pos: impl Into<Position>, s: &str, style: impl Into<Style>, ) -> Position
Source§fn set_str_wrap(
&mut self,
pos: impl Into<Position>,
s: &str,
wrap: WrapMode,
style: impl Into<Style>,
) -> Position
fn set_str_wrap( &mut self, pos: impl Into<Position>, s: &str, wrap: WrapMode, style: impl Into<Style>, ) -> Position
Source§fn set_str_rect(
&mut self,
rect: impl Into<Rect>,
s: &str,
style: impl Into<Style>,
) -> Position
fn set_str_rect( &mut self, rect: impl Into<Rect>, s: &str, style: impl Into<Style>, ) -> Position
Source§fn set_str_rect_wrap(
&mut self,
rect: impl Into<Rect>,
s: &str,
wrap: WrapMode,
style: impl Into<Style>,
) -> Position
fn set_str_rect_wrap( &mut self, rect: impl Into<Rect>, s: &str, wrap: WrapMode, style: impl Into<Style>, ) -> Position
Source§fn set_str_truncate(
&mut self,
pos: impl Into<Position>,
s: &str,
tail: &str,
tail_style: impl Into<Style>,
) -> Position
fn set_str_truncate( &mut self, pos: impl Into<Position>, s: &str, tail: &str, tail_style: impl Into<Style>, ) -> Position
Source§fn set_str_rect_truncate(
&mut self,
rect: impl Into<Rect>,
s: &str,
tail: &str,
tail_style: impl Into<Style>,
) -> Position
fn set_str_rect_truncate( &mut self, rect: impl Into<Rect>, s: &str, tail: &str, tail_style: impl Into<Style>, ) -> Position
Source§fn str_width(&self, s: &str) -> u16
fn str_width(&self, s: &str) -> u16
s in terminal columns. Read moreAuto Trait Implementations§
impl Freeze for TextBuffer
impl RefUnwindSafe for TextBuffer
impl Send for TextBuffer
impl Sync for TextBuffer
impl Unpin for TextBuffer
impl UnsafeUnpin for TextBuffer
impl UnwindSafe for TextBuffer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> Encode for S
impl<S> Encode for S
Source§fn encode<W: Write>(&self, w: &mut W) -> Result<()>
fn encode<W: Write>(&self, w: &mut W) -> Result<()>
w as escape sequences and text. Read more