pub enum Overflow {
Wrap,
Clip(Cow<'static, str>),
}Expand description
How content that does not fit its box is absorbed.
The frame always closes at the resolved size; overflow is absorbed by the content. This governs the width axis. Height always clips inside the frame.
Clipping carries the marker that stands for what was cut, because which
glyph a terminal can show is the application’s knowledge, not the
library’s: … on a capable terminal, ... where Border::ASCII would
be chosen for the same reason, and "" for a silent cut.
use urushi::Overflow;
let quiet = Overflow::clip();
let marked = Overflow::ellipsis();
let ascii = Overflow::clip_with("...");Variants§
Wrap
Reflow the content to the content width.
Clip(Cow<'static, str>)
Cut inside the frame, ending the cut line with this marker. The frame stays closed; an empty marker cuts silently.
Implementations§
Source§impl Overflow
impl Overflow
Sourcepub fn clip_with(marker: impl Into<Cow<'static, str>>) -> Self
pub fn clip_with(marker: impl Into<Cow<'static, str>>) -> Self
Cuts, ending the line with marker.
The marker occupies cells of its own: the content keeps the box’s width less the marker’s display width. A marker that cannot fit the box is dropped, leaving a silent cut rather than an open frame.
Sourcepub fn clip_marker(&self) -> Option<&str>
pub fn clip_marker(&self) -> Option<&str>
Returns the marker this policy ends a cut line with, if it cuts at all.