Skip to main content

ChatInput

Struct ChatInput 

Source
pub struct ChatInput { /* private fields */ }

Implementations§

Source§

impl ChatInput

Source

pub fn message(window: &mut Window, cx: &mut Context<'_, Self>) -> Self

A Markdown message input, sharing Copilot’s minimum size and Enter bindings.

Source

pub fn compact_message( label: impl Into<SharedString>, input_name: impl Into<SharedString>, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self

An inset plain-text composer with a labelled send action.

An addon set on this composer appears before the shared send controls.

Source

pub fn set_plain_text(&mut self, cx: &mut Context<'_, Self>)

A plain-text message input for a protocol without Markdown, such as IRC: no Write/Preview and no Markdown hint.

Source

pub fn set_busy(&mut self, busy: bool, cx: &mut Context<'_, Self>)

Source

pub fn set_error(&mut self, error: String, cx: &mut Context<'_, Self>)

Source

pub fn set_submit_blocked(&mut self, blocked: bool, cx: &mut Context<'_, Self>)

Prevents submitting the message while leaving its draft editable.

Source

pub fn set_available_height( &mut self, available: f32, cx: &mut Context<'_, Self>, )

The actual board height, excluding neighbouring panes and window chrome.

Source§

impl ChatInput

Source

pub fn set_attachment_budget( &mut self, budget: AttachmentBudget, cx: &mut Context<'_, Self>, )

The owner service’s intake budget. File reads remain the owner’s responsibility.

Source§

impl ChatInput

Source

pub fn new( engine: &str, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self

A composer that asks engine, the chat engine’s display name.

Source

pub fn set_submit_empty( &mut self, submit_empty: bool, cx: &mut Context<'_, Self>, )

Whether Enter on an empty draft submits an empty text. Off by default; an owner turns it on while it has something else to send.

Source

pub fn set_addon(&mut self, addon: Option<AnyView>, cx: &mut Context<'_, Self>)

The toolbar rendered in the group’s bottom addon, or the leading tools on a compact message composer.

Source

pub fn text(&self, cx: &App) -> String

Source

pub fn set_limits( &mut self, limits: Option<DraftLimits>, cx: &mut Context<'_, Self>, )

Opts into the in-frame counter; the host owns protocol validation. Other hosts leave this unset and show no counter.

Source

pub fn set_text( &mut self, text: &str, window: &mut Window, cx: &mut Context<'_, Self>, )

Source

pub fn set_placeholder( &mut self, placeholder: impl Into<SharedString>, window: &mut Window, cx: &mut Context<'_, Self>, )

The hint shown while the draft is empty, such as Message #channel.

Source

pub fn clear(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)

Source

pub fn cursor(&self, cx: &App) -> usize

The text cursor’s byte offset, for completing the word before it.

Source

pub fn selection(&self, cx: &App) -> Range<usize> ⓘ

The selected byte range, or an empty range at the cursor.

Source

pub fn set_selection(&mut self, range: Range<usize>, cx: &mut Context<'_, Self>)

Moves the selection to a byte range in the current draft.

Source

pub fn replace_range( &mut self, range: Range<usize>, text: &str, window: &mut Window, cx: &mut Context<'_, Self>, )

Replaces the bytes in range with text, leaving the cursor after it, as an edit the user can undo. The text then reports ChatInputEvent::Changed.

Source

pub fn focus(&self, window: &mut Window, cx: &mut App)

Source

pub fn completion_key(&self) -> Option<CompletionKey>

The key, Tab or Enter, behind the latest ChatInputEvent::Complete this input emitted; None before any. An owner reads it while handling that event.

Source

pub fn set_completing(&mut self, completing: bool, cx: &mut Context<'_, Self>)

While a completion list is open, Enter emits ChatInputEvent::Complete rather than sending.

Source

pub fn set_recall_keys(&mut self, recall: bool, cx: &mut Context<'_, Self>)

Up and Down emit ChatInputEvent::Previous and ChatInputEvent::Next, and Tab emits ChatInputEvent::Complete, for an owner that recalls sent lines and completes names. The arrow keys recall while the draft is empty or recalled. In an edited draft they jump to the start and end. When a completion list is open the arrows continue to move through its choices.

Source

pub fn set_recalled(&mut self, recalled: bool, cx: &mut Context<'_, Self>)

Whether the draft is a line the owner recalled and the user has not edited. Up and Down then keep recalling even when it has several lines, so a multi-line message does not stop the walk through the sent lines.

Source

pub fn set_disabled(&mut self, disabled: bool, cx: &mut Context<'_, Self>)

Disables the text area, for a chat that takes no message, such as a replay of a cloud agent session.

Trait Implementations§

Source§

impl EventEmitter<ChatInputEvent> for ChatInput

Source§

impl Render for ChatInput

Source§

fn render( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> impl IntoElement

Render this view into an element tree.

Auto Trait Implementations§

§

impl !RefUnwindSafe for ChatInput

§

impl !Send for ChatInput

§

impl !Sync for ChatInput

§

impl !UnwindSafe for ChatInput

§

impl Forget for ChatInput

§

impl Freeze for ChatInput
where NonZero<u32>: Freeze, *const (): Freeze, *const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Freeze, PhantomData<fn(InputBaseState<TextareaMode>) -> InputBaseState<TextareaMode>>: Freeze, &'static str: Freeze, *const ArcInner<str> is !null: Freeze, PhantomData<ArcInner<str>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: Freeze, *const dyn FnOnce() is !null: Freeze, PhantomData<dyn FnOnce()>: Freeze,

§

impl Move for ChatInput

§

impl Unpin for ChatInput
where NonZero<u32>: Unpin, *const (): Unpin, *const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Unpin, &'static str: Unpin, Arc<str>: Unpin, *const u8 is !null: Unpin, Arc<RwLock<RawRwLock, FocusMap>>: Unpin, Box<dyn FnOnce()>: Unpin,

§

impl UnsafeUnpin for ChatInput
where NonZeroU32Inner: UnsafeUnpin, *const (): UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: UnsafeUnpin, PhantomData<fn(InputBaseState<TextareaMode>) -> InputBaseState<TextareaMode>>: UnsafeUnpin, &'static str: UnsafeUnpin, *const ArcInner<str> is !null: UnsafeUnpin, PhantomData<ArcInner<str>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: UnsafeUnpin, *const dyn FnOnce() is !null: UnsafeUnpin, PhantomData<dyn FnOnce()>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ParallelSend for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more