diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-02-08 17:35:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-08 17:35:55 +0100 |
| commit | 326c8cd3c6566e8fa4acd3a9369c718ce96f6625 (patch) | |
| tree | 805ded9e78a35e9cd1ae91594358c8888a53abe2 /default-plugins | |
| parent | docs(changelog): cwd fixes (diff) | |
| download | sl0ppij-326c8cd3c6566e8fa4acd3a9369c718ce96f6625.tar.gz sl0ppij-326c8cd3c6566e8fa4acd3a9369c718ce96f6625.tar.xz sl0ppij-326c8cd3c6566e8fa4acd3a9369c718ce96f6625.zip | |
feat(panes): allow specifying coordinates for a new floating pane through the CLI or plugins (#3122)
* working
* add tests
* add coordinates to all the places
* refactor: move things around:
* style(fmt): rustfmt
* style(code): cleanups
Diffstat (limited to 'default-plugins')
| -rw-r--r-- | default-plugins/fixture-plugin-for-tests/src/main.rs | 38 | ||||
| -rw-r--r-- | default-plugins/strider/src/search/search_state.rs | 26 |
2 files changed, 40 insertions, 24 deletions
diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs index 17f29943..fe740f74 100644 --- a/default-plugins/fixture-plugin-for-tests/src/main.rs +++ b/default-plugins/fixture-plugin-for-tests/src/main.rs @@ -167,10 +167,13 @@ impl ZellijPlugin for State { }); }, Key::Ctrl('h') => { - open_file_floating(FileToOpen { - path: std::path::PathBuf::from("/path/to/my/file.rs"), - ..Default::default() - }); + open_file_floating( + FileToOpen { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + ..Default::default() + }, + None, + ); }, Key::Ctrl('i') => { open_file(FileToOpen { @@ -180,11 +183,14 @@ impl ZellijPlugin for State { }); }, Key::Ctrl('j') => { - open_file_floating(FileToOpen { - path: std::path::PathBuf::from("/path/to/my/file.rs"), - line_number: Some(42), - ..Default::default() - }); + open_file_floating( + FileToOpen { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + line_number: Some(42), + ..Default::default() + }, + None, + ); }, Key::Ctrl('k') => { open_terminal(std::path::PathBuf::from("/path/to/my/file.rs").as_path()); @@ -192,6 +198,7 @@ impl ZellijPlugin for State { Key::Ctrl('l') => { open_terminal_floating( std::path::PathBuf::from("/path/to/my/file.rs").as_path(), + None, ); }, Key::Ctrl('m') => { @@ -202,11 +209,14 @@ impl ZellijPlugin for State { }); }, Key::Ctrl('n') => { - open_command_pane_floating(CommandToRun { - path: std::path::PathBuf::from("/path/to/my/file.rs"), - args: vec!["arg1".to_owned(), "arg2".to_owned()], - ..Default::default() - }); + open_command_pane_floating( + CommandToRun { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + args: vec!["arg1".to_owned(), "arg2".to_owned()], + ..Default::default() + }, + None, + ); }, Key::Ctrl('o') => { switch_tab_to(1); diff --git a/default-plugins/strider/src/search/search_state.rs b/default-plugins/strider/src/search/search_state.rs index 834a74fe..60d03941 100644 --- a/default-plugins/strider/src/search/search_state.rs +++ b/default-plugins/strider/src/search/search_state.rs @@ -88,10 +88,13 @@ impl SearchState { match self.selected_search_result_entry() { Some(SearchResult::File { path, .. }) => { if self.should_open_floating { - open_file_floating(FileToOpen { - path: PathBuf::from(path), - ..Default::default() - }); + open_file_floating( + FileToOpen { + path: PathBuf::from(path), + ..Default::default() + }, + None, + ); } else { open_file(FileToOpen { path: PathBuf::from(path), @@ -103,11 +106,14 @@ impl SearchState { path, line_number, .. }) => { if self.should_open_floating { - open_file_floating(FileToOpen { - path: PathBuf::from(path), - line_number: Some(line_number), - ..Default::default() - }); + open_file_floating( + FileToOpen { + path: PathBuf::from(path), + line_number: Some(line_number), + ..Default::default() + }, + None, + ); } else { open_file(FileToOpen { path: PathBuf::from(path), @@ -132,7 +138,7 @@ impl SearchState { { let dir_path = dir_path_of_result(&path); if self.should_open_floating { - open_terminal_floating(&dir_path); + open_terminal_floating(&dir_path, None); } else { open_terminal(&dir_path); } |
