[−][src]Struct titik::InputBuffer
Input buffer is a 1 dimensional text buffer. It process keystroke and create a string representation depending on each key added to it. If arrow key (ie. left, right) is pressed the cursor location will be changed 1 cell backward/forward with respect to the key being pressed. If backspace stroke is receive, the left most cell relative to the cursor will be remove and all the elements on the right side will be shifted to the left.
TODO: deal with character that spans more than 1 cell
Implementations
impl InputBuffer
[src]
pub fn new() -> Self
[src]
create a new input buffer
pub fn new_with_value<S: ToString>(value: S) -> Self
[src]
create an instance of this input buffer with the buffer content set to value.
pub fn get_content(&self) -> &str
[src]
return the content of the buffer
pub fn get_cursor_location(&self) -> usize
[src]
return the cursor location of the buffer
pub fn set_cursor_loc(&mut self, x: usize)
[src]
set the cursor location on this buffer
pub fn process_key_event(
&mut self,
KeyEvent { code: code, modifiers: _ }: KeyEvent
)
[src]
&mut self,
KeyEvent { code: code, modifiers: _ }: KeyEvent
)
Process key events
Keys to be processed:
- Left
- Right
- Home
- End
- Delete
- Backspace
- Char(char)
Trait Implementations
impl Clone for InputBuffer
[src]
fn clone(&self) -> InputBuffer
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for InputBuffer
[src]
impl Default for InputBuffer
[src]
fn default() -> InputBuffer
[src]
impl PartialEq<InputBuffer> for InputBuffer
[src]
fn eq(&self, other: &InputBuffer) -> bool
[src]
fn ne(&self, other: &InputBuffer) -> bool
[src]
impl StructuralPartialEq for InputBuffer
[src]
Auto Trait Implementations
impl RefUnwindSafe for InputBuffer
impl Send for InputBuffer
impl Sync for InputBuffer
impl Unpin for InputBuffer
impl UnwindSafe for InputBuffer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,