aboutsummaryrefslogtreecommitdiffstats
path: root/default-plugins/sequence/src/state/editing.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-02-17 15:43:28 +0100
committerGitHub <noreply@github.com>2026-02-17 15:43:28 +0100
commit4e66a0beff5e41bda1dbde521fa1d2858c46fe7b (patch)
tree380bee5eeac56bea2ebf341cccbe69615585e394 /default-plugins/sequence/src/state/editing.rs
parentFix startup message and cache file creation (#4705) (diff)
downloadsl0ppij-4e66a0beff5e41bda1dbde521fa1d2858c46fe7b.tar.gz
sl0ppij-4e66a0beff5e41bda1dbde521fa1d2858c46fe7b.tar.xz
sl0ppij-4e66a0beff5e41bda1dbde521fa1d2858c46fe7b.zip
Revamp the sequence plugin (#4713)
* initial pipe interface * initial open_x_pane_in_new_tab plugin api implementation * fix: send CommandPaneExited for command panes opened as initial_terminals in new tabs from plugins * open panes in place of specific pane id plugin commands - initial implementation * sequence and plugin api ux * focus self when starting * combine ui and pipe paths * highlight selected pane * initial sequence removal of editing capabilities * fix: translate plugin paths in api * properly trim commands when loaded from pipe or pasted text * minor ux fixes * get ctrl c to work properly * behavior fixes * more ui fixes * fix tests * close tab and end sequence properly * default to AND * zellij sequence alias * add alias * consolidate paths * rustfmt * fix ui padding * add pr * fix: reset scrolling when resetting terminal state
Diffstat (limited to 'default-plugins/sequence/src/state/editing.rs')
-rw-r--r--default-plugins/sequence/src/state/editing.rs80
1 files changed, 0 insertions, 80 deletions
diff --git a/default-plugins/sequence/src/state/editing.rs b/default-plugins/sequence/src/state/editing.rs
deleted file mode 100644
index 3deac619..00000000
--- a/default-plugins/sequence/src/state/editing.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-use crate::path_formatting;
-use crate::state::CommandEntry;
-use crate::ui::text_input::TextInput;
-use std::path::PathBuf;
-
-pub struct Editing {
- pub editing_input: Option<TextInput>,
-}
-
-impl Editing {
- pub fn new() -> Self {
- Self {
- editing_input: Some(TextInput::new("".to_owned())),
- }
- }
-
- pub fn start_editing(&mut self, text: String) {
- self.editing_input = Some(TextInput::new(text));
- }
-
- pub fn cancel_editing(&mut self) {
- self.editing_input = None;
- }
-
- pub fn input_text(&self) -> Option<String> {
- self.editing_input.as_ref().map(|e| e.get_text().to_owned())
- }
-
- pub fn set_input_text(&mut self, text: String) {
- self.editing_input.as_mut().map(|e| e.set_text(text));
- }
-
- pub fn handle_submit(
- &mut self,
- selection_index: Option<usize>,
- all_commands: &mut Vec<CommandEntry>,
- current_cwd: &Option<PathBuf>,
- ) -> (bool, Option<usize>) {
- let mut handled_internally = false;
- let mut new_selection_index = None;
-
- if let Some(current_text) = self.editing_input.as_ref().map(|i| i.get_text()) {
- if let Some(index) = selection_index {
- if let Some(command) = all_commands.get_mut(index) {
- if current_text.starts_with("cd ") || current_text == "cd" {
- let path = if current_text == "cd" {
- "~"
- } else {
- current_text[3..].trim()
- };
-
- if let Some(new_cwd) =
- path_formatting::resolve_path(current_cwd.as_ref(), path)
- {
- command.set_cwd(Some(new_cwd));
- }
-
- command.set_text("".to_owned());
- self.editing_input.as_mut().map(|c| c.clear());
- new_selection_index = selection_index; // remain editing after a cd command
- handled_internally = true;
- return (handled_internally, new_selection_index); // avoid setting edit_input to None below, we
- // still want to be in editing mode after
- // changing directory with cd
- } else {
- command.set_text(current_text.to_owned());
- }
- }
- }
- }
- self.editing_input = None;
- (handled_internally, new_selection_index)
- }
-}
-
-impl Default for Editing {
- fn default() -> Self {
- Self::new()
- }
-}