pub enum Dot {
Cur {
c: Cur,
},
Range {
r: Range,
},
}
Expand description
A Dot represents the currently selected contents of a Buffer.
Most of the editing commands available in ad which manipulate the buffer contents
do so via setting and manipulating the current dot. The name comes from the fact
that the representation of the current Dot in the editing language is .
Variants§
Cur
A single character [Cur]
Fields
c: Cur
The cursor
Range
A [Range] between two cursors
Fields
r: Range
The range
Implementations§
Source§impl Dot
impl Dot
Sourcepub fn from_char_indices(from: usize, to: usize) -> Self
pub fn from_char_indices(from: usize, to: usize) -> Self
Construct a new [Range] dot from two cursor indices.
to
will be used as the active cursor position.
Sourcepub fn as_char_indices(&self) -> (usize, usize)
pub fn as_char_indices(&self) -> (usize, usize)
Convert a Dot into character offsets within the buffer idendifying its start and end positions.
For a [Cur] dot the start and end are equal
Sourcepub fn contains_range(&self, rng: &Range) -> bool
pub fn contains_range(&self, rng: &Range) -> bool
Whether or not this dot contains all of rng
within it.
Sourcepub fn addr(&self, b: &Buffer) -> String
pub fn addr(&self, b: &Buffer) -> String
The address representation of this dot in the form that is enterable by the user. Indices are 1-based rather than their internal 0-based representation.
Sourcepub fn active_cur(&self) -> Cur
pub fn active_cur(&self) -> Cur
The active cursor position for this Dot which will be manipulated by movement operations
Sourcepub fn set_active_cur(&mut self, cur: Cur)
pub fn set_active_cur(&mut self, cur: Cur)
Set the active cursor position for this Dot directly, replacing the current active cursor.
Sourcepub fn as_range(&self) -> Range
pub fn as_range(&self) -> Range
This Dot expressed as a [Range].
For range dots the underlying range is returned directly. For cursor dots a new range is
constructed where start
and end
are equal and the end
is the active cursor.
Sourcepub fn collapse_to_first_cur(&self) -> Self
pub fn collapse_to_first_cur(&self) -> Self
The Dot equivalent of Dot::first_cur.
Sourcepub fn collapse_to_last_cur(&self) -> Self
pub fn collapse_to_last_cur(&self) -> Self
The Dot equivalent of Dot::last_cur.
Trait Implementations§
Source§impl Ord for Dot
impl Ord for Dot
Source§impl PartialOrd for Dot
impl PartialOrd for Dot
impl Copy for Dot
impl Eq for Dot
impl StructuralPartialEq for Dot
Auto Trait Implementations§
impl Freeze for Dot
impl RefUnwindSafe for Dot
impl Send for Dot
impl Sync for Dot
impl Unpin for Dot
impl UnwindSafe for Dot
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
key
and return true
if they are equal.