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§
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)
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 with_offset_saturating(self, offset: isize) -> Self
pub fn with_offset_saturating(self, offset: isize) -> Self
Apply an offset to the cursors within this Dot using saturating subtraction.
Dot::clamp_idx will still need to be called in order to ensure that the result is within bounds for the given buffer.
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 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.
Sourcepub fn collapse_to_active_cur(&self) -> Self
pub fn collapse_to_active_cur(&self) -> Self
The Dot equivalent of Dot::active_cur.
Sourcepub fn collapse_null_range(self) -> Self
pub fn collapse_null_range(self) -> Self
If both ends of a Range match then replace with a single 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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)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.