summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2022-06-10 20:03:13 +0200
committerGitHub <noreply@github.com>2022-06-10 20:03:13 +0200
commit67d2673cae60954e8287c2a1f58a21a56e066afb (patch)
tree5c469728075ea59723951c6b535253e30ebeaec4
parentbcaa6b82c5c3eec824110387b396aacae3a52e21 (diff)
add(style): add trailing comma in match blocks (#1483)
This makes it easier to distinguish from normal blocks
-rw-r--r--.rustfmt.toml1
-rw-r--r--default-plugins/compact-bar/src/main.rs16
-rw-r--r--default-plugins/status-bar/src/first_line.rs8
-rw-r--r--default-plugins/status-bar/src/main.rs18
-rw-r--r--default-plugins/status-bar/src/second_line.rs8
-rw-r--r--default-plugins/status-bar/src/tip/cache.rs6
-rw-r--r--default-plugins/strider/src/main.rs20
-rw-r--r--default-plugins/strider/src/state.rs2
-rw-r--r--default-plugins/tab-bar/src/main.rs16
-rw-r--r--src/commands.rs32
-rw-r--r--src/sessions.rs26
-rw-r--r--src/tests/e2e/remote_runner.rs6
-rw-r--r--zellij-client/src/input_handler.rs46
-rw-r--r--zellij-client/src/lib.rs22
-rw-r--r--zellij-client/src/os_input_output.rs10
-rw-r--r--zellij-client/src/stdin_ansi_parser.rs18
-rw-r--r--zellij-server/src/lib.rs24
-rw-r--r--zellij-server/src/os_input_output.rs8
-rw-r--r--zellij-server/src/output/mod.rs6
-rw-r--r--zellij-server/src/panes/floating_panes/mod.rs28
-rw-r--r--zellij-server/src/panes/grid.rs192
-rw-r--r--zellij-server/src/panes/link_handler.rs4
-rw-r--r--zellij-server/src/panes/plugin_pane.rs6
-rw-r--r--zellij-server/src/panes/terminal_character.rs112
-rw-r--r--zellij-server/src/panes/terminal_pane.rs26
-rw-r--r--zellij-server/src/panes/tiled_panes/mod.rs20
-rw-r--r--zellij-server/src/panes/tiled_panes/tiled_pane_grid.rs4
-rw-r--r--zellij-server/src/pty.rs38
-rw-r--r--zellij-server/src/pty_writer.rs4
-rw-r--r--zellij-server/src/route.rs134
-rw-r--r--zellij-server/src/screen.rs176
-rw-r--r--zellij-server/src/tab/clipboard.rs4
-rw-r--r--zellij-server/src/tab/mod.rs28
-rw-r--r--zellij-server/src/ui/boundaries.rs68
-rw-r--r--zellij-server/src/ui/pane_boundaries_frame.rs14
-rw-r--r--zellij-server/src/ui/pane_contents_and_ui.rs2
-rw-r--r--zellij-server/src/wasm_vm.rs16
-rw-r--r--zellij-utils/src/input/config.rs4
-rw-r--r--zellij-utils/src/input/keybinds.rs12
-rw-r--r--zellij-utils/src/input/layout.rs22
-rw-r--r--zellij-utils/src/input/mod.rs10
-rw-r--r--zellij-utils/src/input/plugins.rs4
-rw-r--r--zellij-utils/src/ipc.rs2
-rw-r--r--zellij-utils/src/setup.rs28
-rw-r--r--zellij-utils/src/shared.rs2
45 files changed, 627 insertions, 626 deletions
diff --git a/.rustfmt.toml b/.rustfmt.toml
new file mode 100644
index 000000000..8c795ae5d
--- /dev/null
+++ b/.rustfmt.toml
@@ -0,0 +1 @@
+match_block_trailing_comma = true
diff --git a/default-plugins/compact-bar/src/main.rs b/default-plugins/compact-bar/src/main.rs
index 3e875a269..cf85d5d9b 100644
--- a/default-plugins/compact-bar/src/main.rs
+++ b/default-plugins/compact-bar/src/main.rs
@@ -49,23 +49,23 @@ impl ZellijPlugin for State {
} else {
eprintln!("Could not find active tab.");
}
- }
+ },
Event::Mouse(me) => match me {
Mouse::LeftClick(_, col) => {
self.mouse_click_pos = col;
self.should_render = true;
- }
+ },
Mouse::ScrollUp(_) => {
switch_tab_to(min(self.active_tab_idx + 1, self.tabs.len()) as u32);
- }
+ },
Mouse::ScrollDown(_) => {
switch_tab_to(max(self.active_tab_idx.saturating_sub(1), 1) as u32);
- }
- _ => {}
+ },
+ _ => {},
},
_ => {
eprintln!("Got unrecognized event: {:?}", event);
- }
+ },
}
}
@@ -130,10 +130,10 @@ impl ZellijPlugin for State {
match background {
PaletteColor::Rgb((r, g, b)) => {
println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", s, r, g, b);
- }
+ },
PaletteColor::EightBit(color) => {
println!("{}\u{1b}[48;5;{}m\u{1b}[0K", s, color);
- }
+ },
}
self.should_render = false;
}
diff --git a/default-plugins/status-bar/src/first_line.rs b/default-plugins/status-bar/src/first_line.rs
index dc7b95ecc..a4fa91b86 100644
--- a/default-plugins/status-bar/src/first_line.rs
+++ b/default-plugins/status-bar/src/first_line.rs
@@ -261,16 +261,16 @@ fn single_letter_ctrl_key(
match key.mode {
CtrlKeyMode::Unselected => {
unselected_mode_shortcut_single_letter(letter_shortcut, palette, separator)
- }
+ },
CtrlKeyMode::UnselectedAlternate => {
unselected_alternate_mode_shortcut_single_letter(letter_shortcut, palette, separator)
- }
+ },
CtrlKeyMode::Selected => {
selected_mode_shortcut_single_letter(letter_shortcut, palette, separator)
- }
+ },
CtrlKeyMode::Disabled => {
disabled_mode_shortcut(&format!(" {}", letter_shortcut), palette, separator)
- }
+ },
}
}
diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs
index 4a53fed8a..23ee3de76 100644
--- a/default-plugins/status-bar/src/main.rs
+++ b/default-plugins/status-bar/src/main.rs
@@ -237,21 +237,21 @@ impl ZellijPlugin for State {
match event {
Event::ModeUpdate(mode_info) => {
self.mode_info = mode_info;
- }
+ },
Event::TabUpdate(tabs) => {
self.tabs = tabs;
- }
+ },
Event::CopyToClipboard(copy_destination) => {
self.text_copy_destination = Some(copy_destination);
- }
+ },
Event::SystemClipboardFailure => {
self.display_system_clipboard_failure = true;
- }
+ },
Event::InputReceived => {
self.text_copy_destination = None;
self.display_system_clipboard_failure = false;
- }
- _ => {}
+ },
+ _ => {},
}
}
@@ -284,10 +284,10 @@ impl ZellijPlugin for State {
match background {
PaletteColor::Rgb((r, g, b)) => {
println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", first_line, r, g, b);
- }
+ },
PaletteColor::EightBit(color) => {
println!("{}\u{1b}[48;5;{}m\u{1b}[0K", first_line, color);
- }
+ },
}
println!("\u{1b}[m{}\u{1b}[0K", second_line);
}
@@ -319,7 +319,7 @@ impl State {
InputMode::Normal => floating_panes_are_visible(&self.mode_info.style.colors),
InputMode::Locked => {
locked_floating_panes_are_visible(&self.mode_info.style.colors)
- }
+ },
_ => keybinds(&self.mode_info, &self.tip_name, cols),
}
} else {
diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs
index 9b6540336..56a71e4b5 100644
--- a/default-plugins/status-bar/src/second_line.rs
+++ b/default-plugins/status-bar/src/second_line.rs
@@ -224,7 +224,7 @@ fn shortened_shortcut_list(help: &ModeInfo, tip: TipFn) -> LinePart {
InputMode::Tmux => short_tmux_mode_indication(help),
InputMode::RenamePane => {
shortened_shortcut_list_nonstandard_mode(select_pane_shortcut)(help)
- }
+ },
_ => shortened_shortcut_list_nonstandard_mode(confirm_pane_selection)(help),
}
}
@@ -279,7 +279,7 @@ fn best_effort_shortcut_list(help: &ModeInfo, tip: TipFn, max_len: usize) -> Lin
} else {
LinePart::default()
}
- }
+ },
InputMode::Locked => {
let line_part = locked_interface_indication(help.style.colors);
if line_part.len <= max_len {
@@ -287,11 +287,11 @@ fn best_effort_shortcut_list(help: &ModeInfo, tip: TipFn, max_len: usize) -> Lin
} else {
LinePart::default()
}
- }
+ },
InputMode::Tmux => best_effort_tmux_shortcut_list(help, max_len),
InputMode::RenamePane => {
best_effort_shortcut_list_nonstandard_mode(select_pane_shortcut)(help, max_len)
- }
+ },
_ => best_effort_shortcut_list_nonstandard_mode(confirm_pane_selection)(help, max_len),
}
}
diff --git a/default-plugins/status-bar/src/tip/cache.rs b/default-plugins/status-bar/src/tip/cache.rs
index dece82437..e62e658d9 100644
--- a/default-plugins/status-bar/src/tip/cache.rs
+++ b/default-plugins/status-bar/src/tip/cache.rs
@@ -47,7 +47,7 @@ impl LocalCache {
});
}
Err(LocalCacheError::Serde(err))
- }
+ },
}
}
@@ -64,7 +64,7 @@ impl LocalCache {
let metadata = LocalCache::from_json(&json_cache)?;
Ok(LocalCache { path, metadata })
- }
+ },
Err(e) => Err(LocalCacheError::IoPath(e, path)),
}
}
@@ -77,7 +77,7 @@ impl LocalCache {
file.write_all(json_cache.as_bytes())
.map_err(LocalCacheError::Io)?;
Ok(())
- }
+ },
Err(e) => Err(LocalCacheError::Serde(e)),
}
}
diff --git a/default-plugins/strider/src/main.rs b/default-plugins/strider/src/main.rs
index 4ce0b0434..22ca1c614 100644
--- a/default-plugins/strider/src/main.rs
+++ b/default-plugins/strider/src/main.rs
@@ -24,15 +24,15 @@ impl ZellijPlugin for State {
Event::Key(key) => match key {
Key::Up | Key::Char('k') => {
*self.selected_mut() = self.selected().saturating_sub(1);
- }
+ },
Key::Down | Key::Char('j') => {
let next = self.selected().saturating_add(1);
*self.selected_mut() = min(self.files.len().saturating_sub(1), next);
- }
+ },
Key::Right | Key::Char('\n') | Key::Char('l') if !self.files.is_empty() => {
self.traverse_dir_or_open_file();
self.ev_history.clear();
- }
+ },
Key::Left | Key::Char('h') => {
if self.path.components().count() > 2 {
// don't descend into /host
@@ -42,11 +42,11 @@ impl ZellijPlugin for State {
self.path.pop();
refresh_directory(self);
}
- }
+ },
Key::Char('.') => {
self.toggle_hidden_files();
refresh_directory(self);
- }
+ },
_ => (),
},
@@ -54,10 +54,10 @@ impl ZellijPlugin for State {
Mouse::ScrollDown(_) => {
let next = self.selected().saturating_add(1);
*self.selected_mut() = min(self.files.len().saturating_sub(1), next);
- }
+ },
Mouse::ScrollUp(_) => {
*self.selected_mut() = self.selected().saturating_sub(1);
- }
+ },
Mouse::Release(line, _) => {
if line < 0 {
return;
@@ -75,12 +75,12 @@ impl ZellijPlugin for State {
if should_select && self.scroll() + (line as usize) < self.files.len() {
*self.selected_mut() = self.scroll() + (line as usize);
}
- }
- _ => {}
+ },
+ _ => {},
},
_ => {
dbg!("Unknown event {:?}", event);
- }
+ },
}
}
diff --git a/default-plugins/strider/src/state.rs b/default-plugins/strider/src/state.rs
index 81d44a61d..05ede0df7 100644
--- a/default-plugins/strider/src/state.rs
+++ b/default-plugins/strider/src/state.rs
@@ -39,7 +39,7 @@ impl State {
FsEntry::Dir(p, _) => {
self.path = p;
refresh_directory(self);
- }
+ },
FsEntry::File(p, _) => open_file(p.strip_prefix(ROOT).unwrap()),
}
}
diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs
index a6647fcef..b11ab87c2 100644
--- a/default-plugins/tab-bar/src/main.rs
+++ b/default-plugins/tab-bar/src/main.rs
@@ -49,23 +49,23 @@ impl ZellijPlugin for State {
} else {
eprintln!("Could not find active tab.");
}
- }
+ },
Event::Mouse(me) => match me {
Mouse::LeftClick(_, col) => {
self.mouse_click_pos = col;
self.should_render = true;
- }
+ },
Mouse::ScrollUp(_) => {
switch_tab_to(min(self.active_tab_idx + 1, self.tabs.len()) as u32);
- }
+ },
Mouse::ScrollDown(_) => {
switch_tab_to(max(self.active_tab_idx.saturating_sub(1), 1) as u32);
- }
- _ => {}
+ },
+ _ => {},
},
_ => {
eprintln!("Got unrecognized event: {:?}", event);
- }
+ },
}
}
@@ -129,10 +129,10 @@ impl ZellijPlugin for State {
match background {
PaletteColor::Rgb((r, g, b)) => {
println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", s, r, g, b);
- }
+ },
PaletteColor::EightBit(color) => {
println!("{}\u{1b}[48;5;{}m\u{1b}[0K", s, color);
- }
+ },
}
self.should_render = false;
}
diff --git a/src/commands.rs b/src/commands.rs
index a2311dc77..f92ba8b43 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -27,7 +27,7 @@ pub(crate) fn kill_all_sessions(yes: bool) {
Ok(sessions) if sessions.is_empty() => {
eprintln!("No active zellij sessions found.");
process::exit(1);
- }
+ },
Ok(sessions) => {
if !yes {
println!("WARNING: this action will kill all sessions.");
@@ -44,11 +44,11 @@ pub(crate) fn kill_all_sessions(yes: bool) {
kill_session_impl(session);
}
process::exit(0);
- }
+ },
Err(e) => {
eprintln!("Error occurred: {:?}", e);
process::exit(1);
- }
+ },
}
}
@@ -58,11 +58,11 @@ pub(crate) fn kill_session(target_session: &Option<String>) {
assert_session(target_session);
kill_session_impl(target_session);
process::exit(0);
- }
+ },
None => {
println!("Please specify the session name to kill.");
process::exit(1);
- }
+ },
}
}
@@ -74,7 +74,7 @@ fn get_os_input<OsInputOutput>(
Err(e) => {
eprintln!("failed to open terminal:\n{}", e);
process::exit(1);
- }
+ },
}
}
@@ -108,7 +108,7 @@ fn find_indexed_session(
);