Buffer

Struct Buffer 

Source
pub struct Buffer {
Show 34 fields pub id: usize, pub file_path: Option<PathBuf>, pub name: String, pub modified: bool, pub datatable: Option<Arc<DataTable>>, pub original_source: Option<Arc<DataTable>>, pub dataview: Option<DataView>, pub mode: AppMode, pub edit_mode: EditMode, pub input: Input, pub input_manager: Box<dyn InputManager>, pub table_state: TableState, pub last_results_row: Option<usize>, pub last_scroll_offset: (usize, usize), pub last_query: String, pub status_message: String, pub sort_state: SortState, pub filter_state: FilterState, pub fuzzy_filter_state: FuzzyFilterState, pub search_state: SearchState, pub column_stats: Option<ColumnStatistics>, pub view_state: ViewState, pub column_widths: Vec<u16>, pub compact_mode: bool, pub show_row_numbers: bool, pub case_insensitive: bool, pub undo_stack: Vec<(String, usize)>, pub redo_stack: Vec<(String, usize)>, pub kill_ring: String, pub last_visible_rows: usize, pub last_query_source: Option<String>, pub highlighted_text_cache: Option<Vec<(String, Color)>>, pub last_highlighted_text: String, pub saved_input_state: Option<(String, usize)>,
}
Expand description

Represents a single buffer/tab with its own independent state

Fields§

§id: usize

Unique identifier for this buffer

§file_path: Option<PathBuf>

File path if loaded from file

§name: String

Display name (filename or “untitled”)

§modified: bool

Whether this buffer has unsaved changes

§datatable: Option<Arc<DataTable>>§original_source: Option<Arc<DataTable>>

Original unmodified DataTable (preserved for query operations)

§dataview: Option<DataView>

DataView for applying filters like hidden columns without modifying the DataTable

§mode: AppMode§edit_mode: EditMode§input: Input§input_manager: Box<dyn InputManager>§table_state: TableState§last_results_row: Option<usize>§last_scroll_offset: (usize, usize)§last_query: String§status_message: String§sort_state: SortState§filter_state: FilterState§fuzzy_filter_state: FuzzyFilterState§search_state: SearchState§column_stats: Option<ColumnStatistics>§view_state: ViewState§column_widths: Vec<u16>§compact_mode: bool§show_row_numbers: bool§case_insensitive: bool§undo_stack: Vec<(String, usize)>§redo_stack: Vec<(String, usize)>§kill_ring: String§last_visible_rows: usize§last_query_source: Option<String>§highlighted_text_cache: Option<Vec<(String, Color)>>§last_highlighted_text: String§saved_input_state: Option<(String, usize)>

Implementations§

Source§

impl Buffer

Source

pub fn new(id: usize) -> Self

Create a new empty buffer

Source

pub fn from_csv( id: usize, path: PathBuf, _csv_client: CsvApiClient, _table_name: String, ) -> Self

Create a buffer from a CSV file

Source

pub fn from_json( id: usize, path: PathBuf, _csv_client: CsvApiClient, _table_name: String, ) -> Self

Create a buffer from a JSON file

Source

pub fn display_name(&self) -> String

Get display name for tab bar

Source

pub fn short_name(&self, max_len: usize) -> String

Get short name for tab bar (truncated if needed)

Source

pub fn has_file(&self, path: &PathBuf) -> bool

Check if buffer has a specific file open

Source

pub fn move_cursor_word_backward(&mut self)

Move cursor to previous word boundary

Source

pub fn move_cursor_word_forward(&mut self)

Move cursor to next word boundary

Source

pub fn delete_word_backward(&mut self)

Delete word backward from cursor

Source

pub fn delete_word_forward(&mut self)

Delete word forward from cursor

Source

pub fn kill_line(&mut self)

Kill line from cursor to end

Source

pub fn kill_line_backward(&mut self)

Kill line from start to cursor

Source

pub fn jump_to_prev_token(&mut self)

Jump to previous SQL token

Source

pub fn jump_to_next_token(&mut self)

Jump to next SQL token

Source

pub fn yank(&mut self)

Yank (paste) from kill ring

Source

pub fn expand_asterisk(&mut self, parser: &HybridParser) -> bool

Expand SELECT * to column names using schema information

Source

pub fn expand_asterisk_visible(&mut self) -> bool

Expand SELECT * to only visible column names

Trait Implementations§

Source§

impl BufferAPI for Buffer

Source§

fn get_id(&self) -> usize

Source§

fn get_query(&self) -> String

Source§

fn set_query(&mut self, query: String)

Source§

fn get_last_query(&self) -> String

Source§

fn set_last_query(&mut self, query: String)

Source§

fn get_datatable(&self) -> Option<&DataTable>

Source§

fn get_datatable_mut(&mut self) -> Option<&mut DataTable>

Source§

fn has_datatable(&self) -> bool

Source§

fn get_original_source(&self) -> Option<&DataTable>

Source§

fn set_datatable(&mut self, datatable: Option<Arc<DataTable>>)

Source§

fn set_results_as_datatable( &mut self, response: Option<QueryResponse>, ) -> Result<(), String>

V50: Helper to convert QueryResponse to DataTable and store it
Source§

fn get_dataview(&self) -> Option<&DataView>

Source§

fn get_dataview_mut(&mut self) -> Option<&mut DataView>

Source§

fn set_dataview(&mut self, dataview: Option<DataView>)

Source§

fn has_dataview(&self) -> bool

Source§

fn get_mode(&self) -> AppMode

Source§

fn set_mode(&mut self, mode: AppMode)

Source§

fn get_edit_mode(&self) -> EditMode

Source§

fn set_edit_mode(&mut self, mode: EditMode)

Source§

fn get_status_message(&self) -> String

Source§

fn set_status_message(&mut self, message: String)

Source§

fn get_selected_row(&self) -> Option<usize>

Source§

fn set_selected_row(&mut self, row: Option<usize>)

Source§

fn get_current_column(&self) -> usize

Source§

fn set_current_column(&mut self, col: usize)

Source§

fn get_scroll_offset(&self) -> (usize, usize)

Source§

fn set_scroll_offset(&mut self, offset: (usize, usize))

Source§

fn get_last_results_row(&self) -> Option<usize>

Source§

fn set_last_results_row(&mut self, row: Option<usize>)

Source§

fn get_last_scroll_offset(&self) -> (usize, usize)

Source§

fn set_last_scroll_offset(&mut self, offset: (usize, usize))

Source§

fn get_filter_pattern(&self) -> String

Source§

fn set_filter_pattern(&mut self, pattern: String)

Source§

fn is_filter_active(&self) -> bool

Source§

fn set_filter_active(&mut self, active: bool)

Source§

fn get_fuzzy_filter_pattern(&self) -> String

Source§

fn set_fuzzy_filter_pattern(&mut self, pattern: String)

Source§

fn is_fuzzy_filter_active(&self) -> bool

Source§

fn set_fuzzy_filter_active(&mut self, active: bool)

Source§

fn get_fuzzy_filter_indices(&self) -> &Vec<usize>

Source§

fn set_fuzzy_filter_indices(&mut self, indices: Vec<usize>)

Source§

fn clear_fuzzy_filter(&mut self)

Source§

fn get_search_pattern(&self) -> String

Source§

fn set_search_pattern(&mut self, pattern: String)

Source§

fn get_search_matches(&self) -> Vec<(usize, usize)>

Source§

fn set_search_matches(&mut self, matches: Vec<(usize, usize)>)

Source§

fn get_current_match(&self) -> Option<(usize, usize)>

Source§

fn set_current_match(&mut self, match_pos: Option<(usize, usize)>)

Source§

fn get_search_match_index(&self) -> usize

Source§

fn set_search_match_index(&mut self, index: usize)

Source§

fn clear_search_state(&mut self)

Source§

fn get_column_stats(&self) -> Option<&ColumnStatistics>

Source§

fn set_column_stats(&mut self, stats: Option<ColumnStatistics>)

Source§

fn get_sort_column(&self) -> Option<usize>

Source§

fn set_sort_column(&mut self, column: Option<usize>)

Source§

fn get_sort_order(&self) -> SortOrder

Source§

fn set_sort_order(&mut self, order: SortOrder)

Source§

fn is_compact_mode(&self) -> bool

Source§

fn set_compact_mode(&mut self, compact: bool)

Source§

fn is_show_row_numbers(&self) -> bool

Source§

fn set_show_row_numbers(&mut self, show: bool)

Source§

fn is_viewport_lock(&self) -> bool

Source§

fn set_viewport_lock(&mut self, locked: bool)

Source§

fn get_viewport_lock_row(&self) -> Option<usize>

Source§

fn set_viewport_lock_row(&mut self, row: Option<usize>)

Source§

fn get_column_widths(&self) -> &Vec<u16>

Source§

fn set_column_widths(&mut self, widths: Vec<u16>)

Source§

fn is_case_insensitive(&self) -> bool

Source§

fn set_case_insensitive(&mut self, case_insensitive: bool)

Source§

fn get_name(&self) -> String

Source§

fn set_name(&mut self, name: String)

Source§

fn get_file_path(&self) -> Option<&PathBuf>

Source§

fn set_file_path(&mut self, path: Option<String>)

Source§

fn is_modified(&self) -> bool

Source§

fn set_modified(&mut self, modified: bool)

Source§

fn get_last_query_source(&self) -> Option<String>

Source§

fn set_last_query_source(&mut self, source: Option<String>)

Source§

fn get_input_value(&self) -> String

Source§

fn set_input_value(&mut self, value: String)

Source§

fn get_input_cursor(&self) -> usize

Source§

fn set_input_cursor(&mut self, pos: usize)

Source§

fn apply_filter(&mut self) -> Result<()>

Source§

fn apply_sort(&mut self) -> Result<()>

Source§

fn search(&mut self) -> Result<()>

Source§

fn clear_filters(&mut self)

Source§

fn get_row_count(&self) -> usize

Source§

fn get_column_count(&self) -> usize

Source§

fn get_column_names(&self) -> Vec<String>

Source§

fn get_undo_stack(&self) -> &Vec<(String, usize)>

Source§

fn push_undo(&mut self, state: (String, usize))

Source§

fn pop_undo(&mut self) -> Option<(String, usize)>

Source§

fn get_redo_stack(&self) -> &Vec<(String, usize)>

Source§

fn push_redo(&mut self, state: (String, usize))

Source§

fn pop_redo(&mut self) -> Option<(String, usize)>

Source§

fn clear_redo(&mut self)

Source§

fn perform_undo(&mut self) -> bool

Source§

fn perform_redo(&mut self) -> bool

Source§

fn save_state_for_undo(&mut self)

Source§

fn get_kill_ring(&self) -> String

Source§

fn set_kill_ring(&mut self, text: String)

Source§

fn is_kill_ring_empty(&self) -> bool

Source§

fn get_last_visible_rows(&self) -> usize

Source§

fn set_last_visible_rows(&mut self, rows: usize)

Source§

fn debug_dump(&self) -> String

Source§

fn get_input_text(&self) -> String

Source§

fn set_input_text(&mut self, text: String)

Source§

fn handle_input_key(&mut self, event: KeyEvent) -> bool

Source§

fn switch_input_mode(&mut self, _multiline: bool)

Source§

fn get_input_cursor_position(&self) -> usize

Source§

fn set_input_cursor_position(&mut self, position: usize)

Source§

fn is_input_multiline(&self) -> bool

Source§

fn navigate_history_up(&mut self, history: &[String]) -> bool

Source§

fn navigate_history_down(&mut self, history: &[String]) -> bool

Source§

fn reset_history_navigation(&mut self)

Source§

fn clear_results(&mut self)

Source§

impl Clone for Buffer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl StateCoordinator for Buffer

Source§

fn process_event(&self, event: &StateEvent) -> StateChange

Process a state event and return changes to apply
Source§

fn apply_change(&mut self, change: StateChange)

Apply a state change to the buffer
Source§

fn emit_event(&self, event: StateEvent)

Emit an event (for notification)

Auto Trait Implementations§

§

impl !Freeze for Buffer

§

impl !RefUnwindSafe for Buffer

§

impl Send for Buffer

§

impl Sync for Buffer

§

impl Unpin for Buffer

§

impl !UnwindSafe for Buffer

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> 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
Source§

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