pub struct CellSelection {
pub node: Key,
pub anchor: CellEnd,
pub focus: CellEnd,
pub block: bool,
}Expand description
A selection inside one cells grid.
Fields§
§node: KeyThe grid it lives in.
anchor: CellEnd§focus: CellEnd§block: boolRectangular rather than linewise: the column range is the same on every line, which is how a terminal selects a column of output. Held by a modifier while dragging, the way every terminal does it.
Implementations§
Source§impl CellSelection
impl CellSelection
pub fn new(node: Key, anchor: CellEnd, focus: CellEnd) -> Self
pub fn block(self, on: bool) -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn to_value(self, handles: Handles) -> Value
pub fn to_value(self, handles: Handles) -> Value
The selection as data — {node, anchor: {line, col}, focus: {line, col}, block}, the ends as the drag made them (directed, like
RangeEnd::to_value’s) and the lines absolute: the shape a
binding’s cell_selection reads back, spelled once.
Sourcepub fn cols_on(&self, line: u64, cols: usize) -> Option<(usize, usize)>
pub fn cols_on(&self, line: u64, cols: usize) -> Option<(usize, usize)>
The columns selected on line, as a half-open range, or None
when the line is outside the selection. Linewise by default — a
line in the middle runs edge to edge, which cols gives — and a
block selection is the same column range on every line it covers.
Trait Implementations§
Source§impl Clone for CellSelection
impl Clone for CellSelection
impl Copy for CellSelection
Source§impl Debug for CellSelection
impl Debug for CellSelection
impl Eq for CellSelection
Source§impl PartialEq for CellSelection
impl PartialEq for CellSelection
impl StructuralPartialEq for CellSelection
Auto Trait Implementations§
impl Freeze for CellSelection
impl RefUnwindSafe for CellSelection
impl Send for CellSelection
impl Sync for CellSelection
impl Unpin for CellSelection
impl UnsafeUnpin for CellSelection
impl UnwindSafe for CellSelection
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.