Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session resurrection #2801

Merged
merged 135 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
01e21e1
add necessary actions in server and utils
olekspickle Apr 12, 2023
ad4480c
update
olekspickle May 16, 2023
4025faa
Merge remote-tracking branch 'origin/main' into feat/saving-tab-layou…
olekspickle May 16, 2023
810a5eb
Merge branch 'main' into feat/saving-tab-layout-to-a-file
olekspickle Jun 28, 2023
a69604e
move all logic relevant to local default config directories to utils:…
olekspickle Jun 28, 2023
65da173
add debug statements for pane geom
olekspickle Jun 28, 2023
71cc15b
add tests; print resulting kdl
olekspickle Jun 29, 2023
a58c945
fix dumping custom layouts from setup; start fixing algorithm for sim…
olekspickle Jul 2, 2023
502fdc0
fix: fixed persistence code and tests to support flexible layouts
Aug 24, 2023
be52cb7
Merge pull request #1 from AlixBernard/feat/panegeom-partition-recons…
olekspickle Sep 17, 2023
09d36fe
fix(tab-bar,compact-bar): tab switching with mouse sometimes not work…
tlinford Jun 30, 2023
6265653
docs(changelog): plugins tab switching with mouse fix
tlinford Jun 30, 2023
b2e6fe6
feat(ui): new status bar mode (#2619)
imsnif Jul 12, 2023
a09b86e
docs(changelog): status-bar supermode
imsnif Jul 12, 2023
7e60a76
fix(rendering): occasional glitches while resizing (#2621)
imsnif Jul 12, 2023
e4ab2ec
docs(changelog): resize glitches fix
imsnif Jul 12, 2023
d71e994
chore(version): bump development version
imsnif Jul 12, 2023
62d6bdb
Fix colored pane frames in mirrored sessions (#2625)
har7an Jul 16, 2023
6ff71e1
fix(sessions): use custom lists of adjectives and nouns for generatin…
khs26 Jul 18, 2023
86e8a65
docs(changelog): generate session names with custom words list
tlinford Jul 18, 2023
ce0b594
feat(plugins): make plugins configurable (#2646)
imsnif Jul 25, 2023
d614f16
docs(changelog): configurable plugins
imsnif Jul 25, 2023
3d9154a
fix(terminal): properly handle resizes in alternate screen (#2654)
imsnif Jul 27, 2023
7c33947
docs(changelog): focus glitches
imsnif Jul 27, 2023
df40730
feat(plugins): utility functions to find active pane and tab (#2652)
Nacho114 Jul 28, 2023
7d4ef51
docs(changelog): plugin api utility functions
imsnif Jul 28, 2023
0fb4000
feat(ui): break pane to new tab and move panes between tabs (#2664)
imsnif Aug 2, 2023
65d361b
docs(changelog): break pane to new tab
imsnif Aug 2, 2023
4b9454f
fix(performance): plug memory leak (#2675)
imsnif Aug 4, 2023
9813418
docs(changelog): plug memory leak
imsnif Aug 4, 2023
4d498d4
feat(plugins): use protocol buffers for serializing across the wasm b…
imsnif Aug 9, 2023
be62683
docs(changelog): protobuffers
imsnif Aug 9, 2023
bff1adf
feat: add plugin permission system (#2624)
jaeheonji Aug 12, 2023
563098d
docs(changelog): permission system
imsnif Aug 12, 2023
2c78940
feat(sessions): add a session manager to switch between sessions, tab…
imsnif Aug 24, 2023
817dbf2
docs(changelog): session manager
imsnif Aug 24, 2023
a071f55
fix(ux): various ui/ux fixes (#2722)
imsnif Aug 24, 2023
c490f4e
docs(changelog): update ux fixes
imsnif Aug 24, 2023
8a0f74f
feat(plugins): optionally move plugin to focused tab (#2725)
imsnif Aug 25, 2023
7633b0e
docs(changelog): move plugin to focused tab
imsnif Aug 25, 2023
2a83633
fix(keybinds): add 'floating' and 'name' to the Run command keybindin…
imsnif Aug 25, 2023
c9cad25
docs(changelog): keybind run floating pane
imsnif Aug 25, 2023
080bbee
fix(plugins): make sure configuration is also part of the plugin keys…
imsnif Aug 25, 2023
65d4166
docs(changelog): fix plugin configuration uniqueness
imsnif Aug 25, 2023
23883ac
fix(plugins): remove protobuf duplications (#2729)
imsnif Aug 25, 2023
fd2075d
Update CHANGELOG.md
imsnif Aug 25, 2023
4be9b7a
fix(plugins): various ui fixes (#2731)
imsnif Aug 26, 2023
096a97b
Update CHANGELOG.md
imsnif Aug 26, 2023
f8ef61c
fix(panes): refocus pane properly on tab change (#2734)
imsnif Aug 27, 2023
d5d541b
docs(changelog): stacked pane focus glitch
imsnif Aug 27, 2023
52891a7
xtask/pipeline: Fix publish task (#2711)
har7an Aug 28, 2023
fc54970
chore(release): v0.38.0
imsnif Aug 28, 2023
fd6a0e9
chore(version): bump development version
imsnif Aug 28, 2023
bd7bb4b
refactor(server): remove unnecessary mut (#2735)
orhun Aug 28, 2023
7d047e1
docs(changelog): refactor server
jaeheonji Aug 28, 2023
bc8248a
chore(repo): update build instructions
imsnif Aug 28, 2023
a63094c
fix(status-bar): add break tab hints (#2748)
imsnif Aug 29, 2023
15f0385
Update CHANGELOG.md
imsnif Aug 29, 2023
f74d0cc
fix(reconnect): do not clear terminal state when entering alternate s…
imsnif Aug 30, 2023
0731232
docs(changelog): fix glitches on windows terminal
imsnif Aug 30, 2023
0efc535
fix(grid): memory leak with unfocused tabs (#2745)
tlinford Aug 30, 2023
35e51f5
docs(changelog): grid memory leak fix
tlinford Aug 30, 2023
a447e7b
fix(input): block input thread for newtiledpane and newfloatingpane a…
imsnif Aug 31, 2023
624900d
docs(changelog): input action new pane fix
imsnif Aug 31, 2023
4ad8d5c
chore(version): adjust version for release
imsnif Aug 31, 2023
182dff7
chore(release): v0.38.1
imsnif Aug 31, 2023
970a762
chore(version): bump development version
imsnif Aug 31, 2023
b4c7134
fix(terminal): wrap lines when adding characters in alternate screen …
imsnif Sep 15, 2023
d68e833
docs(changelog): line wrap bug
imsnif Sep 15, 2023
db0909f
chore(version): bump version for patch release
imsnif Sep 15, 2023
4af934d
chore(release): v0.38.2
imsnif Sep 15, 2023
b97ac0e
chore(version): bump development version
imsnif Sep 15, 2023
433fe96
fix(utils): validate session name (#2607)
deepsghimire Sep 16, 2023
a0c83e0
docs(changelog): fix validate session name
jaeheonji Sep 16, 2023
0959fd0
merge conflict fix
olekspickle Sep 17, 2023
e953fb7
Merge branch 'zellij-org:main' into feat/saving-tab-layout-to-a-file
olekspickle Sep 18, 2023
608bf86
feat(panes): in place run (#2795)
imsnif Sep 19, 2023
1adef73
docs
imsnif Sep 18, 2023
a6655b9
bring in commands to dumped layout
imsnif Sep 19, 2023
6fcda39
tidy up data structures
imsnif Sep 20, 2023
b6a13af
bring in plugins to dumped layout
imsnif Sep 20, 2023
8d4ac4c
Merge branch 'main' into session-resurrection
imsnif Sep 20, 2023
b2202fd
fix tests
imsnif Sep 21, 2023
708b4b6
style(fmt): rustfmt
imsnif Sep 21, 2023
84df41c
chore: rename file (#2803)
AlixBernard Sep 21, 2023
c36c419
bring in floating panes
imsnif Sep 21, 2023
52f4abb
bring in stacked panes
imsnif Sep 23, 2023
fe20094
style(fmt): rustfmt
imsnif Sep 23, 2023
f6ef55f
bring in new_tab_template
imsnif Sep 23, 2023
066caac
bring in swap layouts
imsnif Sep 25, 2023
e9958de
bring in edit panes, command panes and cwds
imsnif Sep 26, 2023
b672cf3
consolidate CWD common prefixes when possible
imsnif Sep 26, 2023
8a98304
filter out default shell
imsnif Sep 26, 2023
4098d6c
style(fmt): rustfmt
imsnif Sep 26, 2023
ada04cb
handle scrollback editor panes properly
imsnif Sep 27, 2023
14a2db0
handle in place panes properly
imsnif Sep 27, 2023
fed789d
bring in pane names
imsnif Sep 27, 2023
3e79a5a
style(fmt): rustfmt
imsnif Sep 27, 2023
2c65496
Merge branch 'main' into session-resurrection
imsnif Sep 28, 2023
ccd5124
style(fmt): rustfmt
imsnif Sep 28, 2023
d8ab551
dump layout action to terminal
imsnif Sep 28, 2023
91200d7
log session layout to HD periodically
imsnif Sep 28, 2023
b4b4366
resurrect dead sessions by attaching to them
imsnif Oct 2, 2023
f36eeb6
delete dead sessions
imsnif Oct 2, 2023
687478a
style(fmt): rustfmt
imsnif Oct 3, 2023
224aedf
start command panes as suspended by default
imsnif Oct 3, 2023
bb9eac6
style(fmt): rustfmt
imsnif Oct 3, 2023
26c6fe9
respect tab/pane focus
imsnif Oct 3, 2023
b3a76e4
improve dump performance
imsnif Oct 3, 2023
5ec1bf2
hide_floating_panes in layout and resurrection
imsnif Oct 4, 2023
6900600
show resurrectable sessions in zellij ls and include timestamps
imsnif Oct 4, 2023
2498574
style(fmt): rustfmt
imsnif Oct 4, 2023
1279743
allow disabling session serialization in config
imsnif Oct 5, 2023
ef949ac
style(fmt): rustfmt
imsnif Oct 5, 2023
05018ca
fix e2e tests
imsnif Oct 5, 2023
dd918cf
add e2e test
imsnif Oct 6, 2023
77b77fb
style(fmt): rustfmt
imsnif Oct 6, 2023
3fb2595
Merge branch 'main' into session-resurrection
imsnif Oct 6, 2023
2678f6c
style(fmt): rustfmt
imsnif Oct 6, 2023
0918bca
serialize and restore pane viewport
imsnif Oct 7, 2023
88c25be
fix e2e tests and add new one
imsnif Oct 9, 2023
1880984
style(fmt): rustfmt
imsnif Oct 9, 2023
5144b29
cleanups
imsnif Oct 9, 2023
6e90a1b
cleanups
imsnif Oct 9, 2023
c922130
more cleanups
imsnif Oct 9, 2023
9044b4d
refactor: move stuff around
imsnif Oct 10, 2023
1d793e1
fix e2e tests
imsnif Oct 10, 2023
641a03d
style(fmt): rustfmt
imsnif Oct 10, 2023
3825368
style(fmt): handle compilation warnings
imsnif Oct 11, 2023
9c040d5
add tests for new layout properties
imsnif Oct 11, 2023
4f24a98
fix current session name indication
imsnif Oct 11, 2023
9adf4c6
style(fmt): rustfmt
imsnif Oct 11, 2023
1e00585
adjust default config
imsnif Oct 12, 2023
76e3c2b
some cleanups
imsnif Oct 12, 2023
06e3f5f
go away clippy
imsnif Oct 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use suggest::Suggest;
use zellij_utils::{
anyhow,
consts::{
session_info_cache_file_name, session_info_folder_for_session,
session_layout_cache_file_name, ZELLIJ_SESSION_INFO_CACHE_DIR, ZELLIJ_SOCK_DIR,
session_info_folder_for_session, session_layout_cache_file_name,
ZELLIJ_SESSION_INFO_CACHE_DIR, ZELLIJ_SOCK_DIR,
},
envs,
humantime::format_duration,
Expand Down Expand Up @@ -164,7 +164,7 @@ pub(crate) fn print_sessions(mut sessions: Vec<(String, Duration, bool)>, no_for
let timestamp = format!("[Created {} ago]", format_duration(*timestamp));
println!("{} {} {}", session_name, timestamp, suffix);
} else {
let session_name = format!("\u{1b}[32;1m{}\u{1b}[m", session_name);
let formatted_session_name = format!("\u{1b}[32;1m{}\u{1b}[m", session_name);
let suffix = if curr_session == *session_name {
format!("(current)")
} else if *is_dead {
Expand All @@ -176,7 +176,7 @@ pub(crate) fn print_sessions(mut sessions: Vec<(String, Duration, bool)>, no_for
"[Created \u{1b}[35;1m{}\u{1b}[m ago]",
format_duration(*timestamp)
);
println!("{} {} {}", session_name, timestamp, suffix);
println!("{} {} {}", formatted_session_name, timestamp, suffix);
}
})
}
Expand Down Expand Up @@ -324,7 +324,7 @@ pub(crate) fn resurrection_layout(session_name_to_resurrect: &str) -> Option<Lay
let resurrectable_sessions = get_resurrectable_sessions();
resurrectable_sessions
.iter()
.find_map(|(name, timestamp, layout)| {
.find_map(|(name, _timestamp, layout)| {
if name == session_name_to_resurrect {
Some(layout.clone())
} else {
Expand Down
3 changes: 1 addition & 2 deletions zellij-server/src/background_jobs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use zellij_utils::async_std::task;
use zellij_utils::consts::{
session_info_cache_file_name, session_info_folder_for_session, session_layout_cache_file_name,
ZELLIJ_SESSION_INFO_CACHE_DIR, ZELLIJ_SOCK_DIR,
ZELLIJ_SOCK_DIR,
};
use zellij_utils::data::SessionInfo;
use zellij_utils::errors::{prelude::*, BackgroundJobContext, ContextType};
Expand All @@ -10,7 +10,6 @@ use std::collections::{BTreeMap, HashMap};
use std::fs;
use std::io::Write;
use std::os::unix::fs::FileTypeExt;
use std::path::PathBuf;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
Expand Down
3 changes: 1 addition & 2 deletions zellij-server/src/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,12 @@ fn write_changed_styles(

fn serialize_chunks_with_newlines(
character_chunks: Vec<CharacterChunk>,
sixel_chunks: Option<&Vec<SixelImageChunk>>,
_sixel_chunks: Option<&Vec<SixelImageChunk>>, // TODO: fix this sometime
link_handler: Option<&mut Rc<RefCell<LinkHandler>>>,
) -> Result<String> {
let err_context = || "failed to serialize input chunks".to_string();

let mut vte_output = String::new();
let mut sixel_vte: Option<String> = None;
let link_handler = link_handler.map(|l_h| l_h.borrow());
for character_chunk in character_chunks {
let chunk_changed_colors = character_chunk.changed_colors();
Expand Down
4 changes: 2 additions & 2 deletions zellij-server/src/panes/floating_panes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl FloatingPanes {

// move clients from the previously active pane to the new pane we just inserted
self.move_clients_between_panes(pane_id, with_pane_id);
self.set_pane_frames();
let _ = self.set_pane_frames();
Copy link
Contributor

@olekspickle olekspickle Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just do this, I believe behavior is the same

Suggested change
let _ = self.set_pane_frames();
_ = self.set_pane_frames();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I appreciate the comment but I see this as cosmetic

removed_pane
}
pub fn remove_pane(&mut self, pane_id: PaneId) -> Option<Box<dyn Pane>> {
Expand Down Expand Up @@ -603,7 +603,7 @@ impl FloatingPanes {
pub fn move_active_pane(
&mut self,
search_backwards: bool,
os_api: &mut Box<dyn ServerOsApi>,
_os_api: &mut Box<dyn ServerOsApi>,
client_id: ClientId,
) {
let active_pane_id = self.get_active_pane_id(client_id).unwrap();
Expand Down
1 change: 0 additions & 1 deletion zellij-server/src/panes/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,6 @@ impl Grid {
for line in &self.viewport {
to_serialize.push(line.clone())
}
let to_serialize_len = to_serialize.len();
self.output_buffer.serialize(to_serialize.as_slice()).ok()
},
None => self.output_buffer.serialize(&self.viewport).ok(),
Expand Down
8 changes: 2 additions & 6 deletions zellij-server/src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,13 @@ pub(crate) fn route_action(
.send_to_screen(ScreenInstruction::DumpScreen(val, client_id, full))
.with_context(err_context)?;
},
Action::DumpLayout(layout) => {
Action::DumpLayout => {
let default_shell = match default_shell {
Some(TerminalAction::RunCommand(run_command)) => Some(run_command.command),
_ => None,
};
senders
.send_to_screen(ScreenInstruction::DumpLayout(
client_id,
layout,
default_shell,
))
.send_to_screen(ScreenInstruction::DumpLayout(default_shell, client_id))
.with_context(err_context)?;
},
Action::EditScrollback => {
Expand Down
21 changes: 9 additions & 12 deletions zellij-server/src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ use zellij_utils::data::{
use zellij_utils::errors::prelude::*;
use zellij_utils::input::command::RunCommand;
use zellij_utils::input::options::Clipboard;
use zellij_utils::pane_size::{PaneGeom, Size, SizeInPixels};
use zellij_utils::pane_size::{Size, SizeInPixels};
use zellij_utils::{
input::command::TerminalAction,
input::layout::{
FloatingPaneLayout, Layout, PluginUserConfiguration, Run, RunPlugin, RunPluginLocation,
SwapFloatingLayout, SwapTiledLayout, TiledPaneLayout,
},
position::Position,
session_serialization::{GlobalLayoutManifest, PaneLayoutManifest, TabLayoutManifest},
};

use crate::background_jobs::BackgroundJob;
Expand All @@ -35,7 +34,7 @@ use crate::{
panes::PaneId,
plugins::PluginInstruction,
pty::{ClientTabIndexOrPaneId, PtyInstruction, VteBytes},
tab::{Pane, Tab},
tab::Tab,
thread_bus::Bus,
ui::{
loading_indication::LoadingIndication,
Expand Down Expand Up @@ -171,7 +170,7 @@ pub enum ScreenInstruction {
Exit,
ClearScreen(ClientId),
DumpScreen(String, ClientId, bool),
DumpLayout(ClientId, Option<String>, Option<PathBuf>), // PathBuf is the default configured
DumpLayout(Option<PathBuf>, ClientId), // PathBuf is the default configured
// shell
EditScrollback(ClientId),
ScrollUp(ClientId),
Expand Down Expand Up @@ -1878,9 +1877,9 @@ impl Screen {
) -> Result<()> {
let err_context = || format!("failed to replace pane");
let suppress_pane = |tab: &mut Tab, pane_id: PaneId, new_pane_id: PaneId| {
tab.suppress_pane_and_replace_with_pid(pane_id, new_pane_id, run);
let _ = tab.suppress_pane_and_replace_with_pid(pane_id, new_pane_id, run);
if let Some(pane_title) = pane_title {
tab.rename_pane(pane_title.as_bytes().to_vec(), new_pane_id);
let _ = tab.rename_pane(pane_title.as_bytes().to_vec(), new_pane_id);
}
if let Some(hold_for_command) = hold_for_command {
let is_first_run = true;
Expand All @@ -1901,7 +1900,7 @@ impl Screen {
);
},
}
})
});
},
ClientTabIndexOrPaneId::PaneId(pane_id) => {
let tab_index = self
Expand All @@ -1919,7 +1918,7 @@ impl Screen {
},
};
},
ClientTabIndexOrPaneId::TabIndex(tab_index) => {
ClientTabIndexOrPaneId::TabIndex(_tab_index) => {
log::error!("Cannot replace pane with tab index");
},
}
Expand Down Expand Up @@ -2162,7 +2161,7 @@ pub(crate) fn screen_thread_main(
log::error!("Tab index not found: {:?}", tab_index);
}
},
ClientTabIndexOrPaneId::PaneId(pane_id) => {
ClientTabIndexOrPaneId::PaneId(_pane_id) => {
log::error!("cannot open a pane with a pane id??");
},
};
Expand Down Expand Up @@ -2396,8 +2395,7 @@ pub(crate) fn screen_thread_main(
screen.render()?;
screen.unblock_input()?;
},
ScreenInstruction::DumpLayout(client_id, layout, default_shell) => {
// TODO: ordering
ScreenInstruction::DumpLayout(default_shell, client_id) => {
let err_context = || format!("Failed to dump layout");
let session_layout_metadata = screen.get_layout_metadata(default_shell);
screen
Expand Down Expand Up @@ -3426,7 +3424,6 @@ pub(crate) fn screen_thread_main(
invoked_with,
client_id_tab_index_or_pane_id,
) => {
let err_context = || format!("Failed to replace pane");
screen.replace_pane(
new_pane_id,
hold_for_command,
Expand Down
15 changes: 7 additions & 8 deletions zellij-server/src/tab/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ pub trait Pane {
None
}
fn rename(&mut self, _buf: Vec<u8>) {}
fn serialize(&self, scrollback_lines_to_serialize: Option<usize>) -> Option<String> {
fn serialize(&self, _scrollback_lines_to_serialize: Option<usize>) -> Option<String> {
None
}
}
Expand Down Expand Up @@ -1166,7 +1166,7 @@ impl Tab {
match new_pane_id {
PaneId::Terminal(new_pane_id) => {
let next_terminal_position = self.get_next_terminal_position(); // TODO: this is not accurate in this case
let mut new_pane = TerminalPane::new(
let new_pane = TerminalPane::new(
new_pane_id,
PaneGeom::default(), // the initial size will be set later
self.style,
Expand All @@ -1191,7 +1191,7 @@ impl Tab {
};
match replaced_pane {
Some(replaced_pane) => {
resize_pty!(
let _ = resize_pty!(
replaced_pane,
self.os_api,
self.senders,
Expand All @@ -1213,8 +1213,7 @@ impl Tab {
}
},
PaneId::Plugin(plugin_pid) => {
// TBD, currently unsupported
let mut new_pane = PluginPane::new(
let new_pane = PluginPane::new(
plugin_pid,
PaneGeom::default(), // this will be filled out later
self.senders
Expand Down Expand Up @@ -1244,7 +1243,7 @@ impl Tab {
};
match replaced_pane {
Some(replaced_pane) => {
resize_pty!(
let _ = resize_pty!(
replaced_pane,
self.os_api,
self.senders,
Expand Down Expand Up @@ -2465,7 +2464,7 @@ impl Tab {
pane_id
)
})
.and_then(|(is_scrollback_editor, suppressed_pane)| {
.and_then(|(_is_scrollback_editor, suppressed_pane)| {
let suppressed_pane_id = suppressed_pane.pid();
let replaced_pane = if self.are_floating_panes_visible() {
Some(self.floating_panes.replace_pane(pane_id, suppressed_pane)).transpose()?
Expand Down Expand Up @@ -3592,7 +3591,7 @@ impl Tab {
let mut floating_pane_info = self.floating_panes.pane_info();
pane_info.append(&mut tiled_pane_info);
pane_info.append(&mut floating_pane_info);
for (pane_id, (is_scrollback_editor, pane)) in self.suppressed_panes.iter() {
for (pane_id, (_is_scrollback_editor, pane)) in self.suppressed_panes.iter() {
let mut pane_info_for_suppressed_pane = pane_info_for_pane(pane_id, pane);
pane_info_for_suppressed_pane.is_floating = false;
pane_info_for_suppressed_pane.is_suppressed = true;
Expand Down
7 changes: 2 additions & 5 deletions zellij-utils/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,8 @@ pub enum CliAction {
#[clap(short, long, value_parser, default_value("false"), takes_value(false))]
full: bool,
},
/// Dump current layout to a specified or default layout directory,
/// and in case path is not provided - stdout
DumpLayout {
path: Option<PathBuf>,
},
/// Dump current layout to stdout
DumpLayout,
/// Open the pane scrollback in your default editor
EditScrollback,
/// Scroll up in the focused pane
Expand Down
47 changes: 7 additions & 40 deletions zellij-utils/src/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,13 @@
//! # This module contain everything you'll need to access local system paths
//! containing configuration and layouts

use crate::input::theme::Themes;
use crate::{
consts::{
SYSTEM_DEFAULT_CONFIG_DIR, SYSTEM_DEFAULT_DATA_DIR_PREFIX, ZELLIJ_DEFAULT_THEMES,
ZELLIJ_PROJ_DIR,
},
errors::prelude::*,
input::{
config::{Config, ConfigError},
layout::Layout,
options::Options,
},
};
use clap::{Args, IntoApp};
use clap_complete::Shell;
use crate::consts::{SYSTEM_DEFAULT_DATA_DIR_PREFIX, ZELLIJ_PROJ_DIR};

#[cfg(not(test))]
use crate::consts::SYSTEM_DEFAULT_CONFIG_DIR;

use directories::BaseDirs;
use log::info;
use serde::{Deserialize, Serialize};
use std::{
convert::TryFrom, fmt::Write as FmtWrite, io::Write, path::Path, path::PathBuf, process,
};
use std::{path::Path, path::PathBuf};

pub(crate) const CONFIG_LOCATION: &str = ".config/zellij";

Expand All @@ -43,6 +29,7 @@ pub fn find_default_config_dir() -> Option<PathBuf> {
}

/// Order in which config directories are checked
#[cfg(not(test))]
pub(crate) fn default_config_dirs() -> Vec<Option<PathBuf>> {
vec![
home_config_dir(),
Expand All @@ -63,26 +50,6 @@ pub fn get_default_data_dir() -> PathBuf {
.unwrap_or_else(xdg_data_dir)
}

#[cfg(not(test))]
pub(crate) fn get_default_themes() -> Themes {
let mut themes = Themes::default();
for file in ZELLIJ_DEFAULT_THEMES.files() {
if let Some(content) = file.contents_utf8() {
match Themes::from_string(&content.to_string()) {
Ok(theme) => themes = themes.merge(theme),
Err(_) => {},
}
}
}

themes
}

#[cfg(test)]
pub(crate) fn get_default_themes() -> Themes {
Themes::default()
}

pub fn xdg_config_dir() -> PathBuf {
ZELLIJ_PROJ_DIR.config_dir().to_owned()
}
Expand Down
6 changes: 2 additions & 4 deletions zellij-utils/src/input/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub enum Action {
/// Dumps the screen to a file
DumpScreen(String, bool),
/// Dumps
DumpLayout(Option<String>),
DumpLayout,
/// Scroll up in focus pane.
EditScrollback,
ScrollUp,
Expand Down Expand Up @@ -282,9 +282,7 @@ impl Action {
path.as_os_str().to_string_lossy().into(),
full,
)]),
CliAction::DumpLayout { path } => Ok(vec![Action::DumpLayout(
path.map(|p| p.as_os_str().to_string_lossy().into()),
)]),
CliAction::DumpLayout => Ok(vec![Action::DumpLayout]),
CliAction::EditScrollback => Ok(vec![Action::EditScrollback]),
CliAction::ScrollUp => Ok(vec![Action::ScrollUp]),
CliAction::ScrollDown => Ok(vec![Action::ScrollDown]),
Expand Down
Loading