pub struct Editor<S>where
S: System,{ /* private fields */ }Expand description
The main editor state.
Implementations§
Source§impl<S> Editor<S>where
S: System,
impl<S> Editor<S>where
S: System,
Sourcepub fn open_file_relative_to_effective_directory(
&mut self,
path: &str,
new_window: bool,
)
pub fn open_file_relative_to_effective_directory( &mut self, path: &str, new_window: bool, )
Open a file within the editor using a path that is relative to the effective directory
Sourcepub fn open_file_relative_to_cwd(
&mut self,
path: impl AsRef<Path>,
new_window: bool,
)
pub fn open_file_relative_to_cwd( &mut self, path: impl AsRef<Path>, new_window: bool, )
Open a file within the editor using a path that is relative to the current working directory
Source§impl Editor<DefaultSystem>
impl Editor<DefaultSystem>
Sourcepub fn new(
cfg: Config,
plumbing_rules: PlumbingRules,
mode: EditorMode,
log_buffer: LogBuffer,
) -> Self
pub fn new( cfg: Config, plumbing_rules: PlumbingRules, mode: EditorMode, log_buffer: LogBuffer, ) -> Self
Construct a new Editor with the provided config.
pub fn new_with_initial_files( config_res: Result<Config, String>, plumbing_rules_res: Result<PlumbingRules, String>, mode: EditorMode, log_buffer: LogBuffer, file_paths: &[impl AsRef<Path>], ) -> Self
Source§impl<S> Editor<S>where
S: System,
impl<S> Editor<S>where
S: System,
Sourcepub fn new_with_system(
config: Config,
plumbing_rules: PlumbingRules,
mode: EditorMode,
log_buffer: LogBuffer,
system: S,
) -> Self
pub fn new_with_system( config: Config, plumbing_rules: PlumbingRules, mode: EditorMode, log_buffer: LogBuffer, system: S, ) -> Self
Construct a new Editor with the provided config and System.
Sourcepub fn new_with_system_and_initial_files(
config_res: Result<Config, String>,
plumbing_rules_res: Result<PlumbingRules, String>,
mode: EditorMode,
log_buffer: LogBuffer,
system: S,
file_paths: &[impl AsRef<Path>],
) -> Self
pub fn new_with_system_and_initial_files( config_res: Result<Config, String>, plumbing_rules_res: Result<PlumbingRules, String>, mode: EditorMode, log_buffer: LogBuffer, system: S, file_paths: &[impl AsRef<Path>], ) -> Self
Construct a new Editor using the provided config and then open a list of initial files based on their file paths relative to the working directory of the editor.
The config and plumbing rules results are used to display parse errors to the user in virtual buffers. In the case that Err is passed for either argument, the default for that type will be used to start the editor so the parser errors can be shown.
Sourcepub fn active_buffer_id(&self) -> usize
pub fn active_buffer_id(&self) -> usize
The id of the currently active buffer
pub fn active_buffer_name(&self) -> &str
pub fn buffer_list(&self) -> Vec<String>
pub fn buffer_content(&self, id: BufferId) -> Option<String>
pub fn buffer_dot(&self, id: BufferId) -> Option<String>
pub fn layout_ids(&self) -> Vec<Vec<BufferId>>
Sourcepub fn effective_directory(&self) -> &Path
pub fn effective_directory(&self) -> &Path
The effective directory of the editor at any point is the directory containing the file backing the active buffer, or if the active buffer can not define a containing directory, self.cwd.
Sourcepub fn run_with_explicit_fsys_path(&mut self, socket_path: PathBuf)
pub fn run_with_explicit_fsys_path(&mut self, socket_path: PathBuf)
Initialise any UI state required for our EditorMode and run the main event loop using a custom path for our fsys socket.
Sourcepub fn run(&mut self)
pub fn run(&mut self)
Initialise any UI state required for our EditorMode and run the main event loop.
pub fn handle_event(&mut self, event: Event)
pub fn refresh_screen_w_minibuffer(&mut self, mb: Option<MiniBufferState<'_>>)
Sourcepub fn set_status_message(&mut self, msg: impl Into<String>)
pub fn set_status_message(&mut self, msg: impl Into<String>)
Update the status line to contain the given message.
pub fn handle_input(&mut self, input: Input)
Sourcepub fn handle_action(&mut self, action: Action, source: Source)
pub fn handle_action(&mut self, action: Action, source: Source)
Process a single action and update editor state accordingly