[−][src]Struct xterm_js_sys::xterm::BufferCell
Represents a single cell in the terminal’s buffer.
(This is a duck-typed interface).
Fields
obj: JsValue
Implementations
impl BufferCell
[src][−]
pub fn get_bg_color(&self) -> Color
[src][−]
Gets a cell’s background color number, this differs depending on what the color mode of the cell is:
- Default: This should be 0, representing the default background color (CSI 49 m).
- Palette: This is a number from 0 to 255 of ANSI colors (CSI 4(0-7) m, CSI 10(0-7) m, CSI 48 ; 5 ; 0-255 m).
- RGB: A hex value representing a ‘true color’: 0xRRGGBB (CSI 4 8 ; 2 ; Pi ; Pr ; Pg ; Pb)
impl BufferCell
[src][−]
pub fn get_bg_color_mode(&self) -> u8
[src][−]
Gets the number representation of the background color mode, this can be
used to perform quick comparisons of 2 cells to see if they’re the same.
Use is_bg_rgb
, is_bg_palette
, and is_bg_default
to check
what color mode a cell is.
impl BufferCell
[src][−]
pub fn get_chars(&self) -> Str
[src][−]
The character(s) within the cell. Examples of what this can contain:
- A normal width character
- A wide character (eg. CJK)
- An emoji
impl BufferCell
[src][−]
pub fn get_code(&self) -> u32
[src][−]
Gets the UTF32 codepoint of single characters, if content is a combined string it returns the codepoint of the last character in the string.
impl BufferCell
[src][−]
pub fn get_fg_color(&self) -> Color
[src][−]
Gets a cell’s foreground color number, this differs depending on what the color mode of the cell is:
- Default: This should be 0, representing the default foreground color (CSI 39 m).
- Palette: This is a number from 0 to 255 of ANSI colors (CSI 3(0-7) m, CSI 9(0-7) m, CSI 38 ; 5 ; 0-255 m).
- RGB: A hex value representing a ‘true color’: 0xRRGGBB. (CSI 3 8 ; 2 ; Pi ; Pr ; Pg ; Pb)
impl BufferCell
[src][−]
pub fn get_fg_color_mode(&self) -> u8
[src][−]
Gets the number representation of the foreground color mode, this can be
used to perform quick comparisons of 2 cells to see if they’re the same.
Use is_fg_rgb
, is_fg_palette
, and is_fg_default
to check
what color mode a cell is.
impl BufferCell
[src][−]
pub fn get_width(&self) -> u8
[src][−]
The width of the character. Some examples:
1
for most cells.2
for wide character like CJK glyphs.0
for cells immediately following cells with a width of2
.
impl BufferCell
[src][−]
pub fn is_attribute_default(&self) -> bool
[src][−]
Whether the cell has the default attribute (no color or style).
impl BufferCell
[src][−]
pub fn is_bg_default(&self) -> bool
[src][−]
Whether the cell is using the default background color mode.
impl BufferCell
[src][−]
pub fn is_bg_palette(&self) -> bool
[src][−]
Whether the cell is using the palette background color mode.
impl BufferCell
[src][−]
impl BufferCell
[src][−]
impl BufferCell
[src][−]
impl BufferCell
[src][−]
impl BufferCell
[src][−]
pub fn is_fg_default(&self) -> bool
[src][−]
Whether the cell is using the default foreground color mode.
impl BufferCell
[src][−]
pub fn is_fg_palette(&self) -> bool
[src][−]
Whether the cell is using the palette foreground color mode.
impl BufferCell
[src][−]
impl BufferCell
[src][−]
pub fn is_inverse(&self) -> bool
[src][−]
Whether the cell has the inverse attribute (CSI 7 m).
impl BufferCell
[src][−]
pub fn is_invisible(&self) -> bool
[src][−]
Whether the cell has the inverse attribute (CSI 8 m).
impl BufferCell
[src][−]
impl BufferCell
[src][−]
pub fn is_underline(&self) -> bool
[src][−]
Whether the cell has the underline attribute (CSI 4 m).
Methods from Deref<Target = JsValue>
pub const NULL: JsValue
[src]
pub const UNDEFINED: JsValue
[src]
pub const TRUE: JsValue
[src]
pub const FALSE: JsValue
[src]
pub fn as_f64(&self) -> Option<f64>
[src][−]
feature="ext"
only.Returns the f64
value of this JS value if it's an instance of a
number.
If this JS value is not an instance of a number then this returns
None
.
pub fn is_string(&self) -> bool
[src][−]
feature="ext"
only.Tests whether this JS value is a JS string.
pub fn as_string(&self) -> Option<String>
[src][−]
feature="ext"
only.If this JS value is a string value, this function copies the JS string
value into wasm linear memory, encoded as UTF-8, and returns it as a
Rust String
.
To avoid the copying and re-encoding, consider the
JsString::try_from()
function from js-sys
instead.
If this JS value is not an instance of a string or if it's not valid
utf-8 then this returns None
.
UTF-16 vs UTF-8
JavaScript strings in general are encoded as UTF-16, but Rust strings
are encoded as UTF-8. This can cause the Rust string to look a bit
different than the JS string sometimes. For more details see the
documentation about the str
type which contains a few
caveats about the encodings.
pub fn as_bool(&self) -> Option<bool>
[src][−]
feature="ext"
only.Returns the bool
value of this JS value if it's an instance of a
boolean.
If this JS value is not an instance of a boolean then this returns
None
.
pub fn is_null(&self) -> bool
[src][−]
feature="ext"
only.Tests whether this JS value is null
pub fn is_undefined(&self) -> bool
[src][−]
feature="ext"
only.Tests whether this JS value is undefined
pub fn is_symbol(&self) -> bool
[src][−]
feature="ext"
only.Tests whether the type of this JS value is symbol
pub fn is_object(&self) -> bool
[src][−]
feature="ext"
only.Tests whether typeof self == "object" && self !== null
.
pub fn is_function(&self) -> bool
[src][−]
feature="ext"
only.Tests whether the type of this JS value is function
.
pub fn is_truthy(&self) -> bool
[src][−]
feature="ext"
only.Tests whether the value is "truthy".
pub fn is_falsy(&self) -> bool
[src][−]
feature="ext"
only.Tests whether the value is "falsy".
Trait Implementations
impl AsRef<BufferCell> for BufferCell
[src][+]
impl AsRef<JsValue> for BufferCell
[src][+]
impl Deref for BufferCell
[src][+]
impl From<BufferCell> for JsValue
[src][+]
impl From<JsValue> for BufferCell
[src][+]
impl FromWasmAbi for BufferCell
[src][+]
impl IntoWasmAbi for BufferCell
[src][+]
impl<'a> IntoWasmAbi for &'a BufferCell
[src][+]
impl JsCast for BufferCell
[src][+]
impl OptionFromWasmAbi for BufferCell
[src][+]
impl OptionIntoWasmAbi for BufferCell
[src][+]
impl<'a> OptionIntoWasmAbi for &'a BufferCell
[src][+]
impl RefFromWasmAbi for BufferCell
[src][+]
impl WasmDescribe for BufferCell
[src][+]
Auto Trait Implementations
impl RefUnwindSafe for BufferCell
impl !Send for BufferCell
impl !Sync for BufferCell
impl Unpin for BufferCell
impl UnwindSafe for BufferCell
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
[src][+]
T: IntoWasmAbi,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,