pub struct ContextMenuCaps {
pub has_selection: bool,
pub clipboard_has_text: bool,
pub can_undo: bool,
pub can_redo: bool,
pub is_full_doc_selected: bool,
}Expand description
Frontend-supplied capabilities the core cannot observe headlessly.
The OS clipboard lives outside twrite-core; GPUI hosts read it once
per right-click and pass the result in. Everything else derives from
the buffer + selection.
Fields§
§has_selection: boolWhether a non-empty selection exists.
clipboard_has_text: boolWhether the OS clipboard currently holds text (supplied by the host).
can_undo: boolWhether an undo transaction is available.
can_redo: boolWhether a redo transaction is available.
is_full_doc_selected: boolWhether the selection already spans the whole document.
Implementations§
Source§impl ContextMenuCaps
impl ContextMenuCaps
Sourcepub fn from_buffer(
buffer: &EditorBuffer,
selection: Option<&Selection>,
clipboard_has_text: bool,
) -> Self
pub fn from_buffer( buffer: &EditorBuffer, selection: Option<&Selection>, clipboard_has_text: bool, ) -> Self
Derives buffer-observable caps; the host ORs in clipboard_has_text.
Trait Implementations§
Source§impl Clone for ContextMenuCaps
impl Clone for ContextMenuCaps
Source§fn clone(&self) -> ContextMenuCaps
fn clone(&self) -> ContextMenuCaps
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ContextMenuCaps
Source§impl Debug for ContextMenuCaps
impl Debug for ContextMenuCaps
Source§impl Default for ContextMenuCaps
impl Default for ContextMenuCaps
Source§fn default() -> ContextMenuCaps
fn default() -> ContextMenuCaps
Returns the “default value” for a type. Read more
impl Eq for ContextMenuCaps
Source§impl PartialEq for ContextMenuCaps
impl PartialEq for ContextMenuCaps
Source§fn eq(&self, other: &ContextMenuCaps) -> bool
fn eq(&self, other: &ContextMenuCaps) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ContextMenuCaps
Auto Trait Implementations§
impl Freeze for ContextMenuCaps
impl RefUnwindSafe for ContextMenuCaps
impl Send for ContextMenuCaps
impl Sync for ContextMenuCaps
impl Unpin for ContextMenuCaps
impl UnsafeUnpin for ContextMenuCaps
impl UnwindSafe for ContextMenuCaps
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