Skip to content

Commit

Permalink
Merge branch 'zellij-org:main' into fix/tab/focus_largest_pane
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyxels authored Jan 7, 2025
2 parents 31b82cb + 3dda02f commit b3936a1
Show file tree
Hide file tree
Showing 157 changed files with 2,908 additions and 1,146 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]
* fix(plugins): properly focus pane after tab was closed in the plugin API (https://github.com/zellij-org/zellij/pull/3797)
* fix(plugins): properly pad UI components background to their declared width (https://github.com/zellij-org/zellij/pull/3806)
* feat(plugins): allow plugins to change their own `/host` folder under a new FullHdAccess permission (https://github.com/zellij-org/zellij/pull/3827)
* fix(plugins): do not detach if using `/` in session name (https://github.com/zellij-org/zellij/pull/3839)
* fix(plugins): properly focus plugin pane after it was hidden (https://github.com/zellij-org/zellij/pull/3841)
* fix(layouts): off by 1 when focusing a specific tab through a layout (https://github.com/zellij-org/zellij/pull/3844)
* fix(multiplayer): properly clear fake cursors (https://github.com/zellij-org/zellij/pull/3845)
* feat(ux): pin floating panes (https://github.com/zellij-org/zellij/pull/3876)
* fix(layout-applier): logical index pane sorting (https://github.com/zellij-org/zellij/pull/3893)
* fix(terminal): synchronized rendering detection query response (https://github.com/zellij-org/zellij/pull/3884)
* fix(terminal): cursor overflow issue (https://github.com/zellij-org/zellij/pull/3894)
* feat(ux): stack panes command (https://github.com/zellij-org/zellij/pull/3905)

## [0.41.2] - 2024-11-19
* fix(input): keypresses not being identified properly with kitty keyboard protocol in some terminals (https://github.com/zellij-org/zellij/pull/3725)
Expand Down
6 changes: 6 additions & 0 deletions default-plugins/configuration/src/presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ keybinds clear-defaults=true {{
bind "w" {{ ToggleFloatingPanes; SwitchToMode "Locked"; }}
bind "e" {{ TogglePaneEmbedOrFloating; SwitchToMode "Locked"; }}
bind "c" {{ SwitchToMode "RenamePane"; PaneNameInput 0;}}
bind "i" {{ TogglePanePinned; SwitchToMode "Locked"; }}
}}
move {{
bind "m" {{ SwitchToMode "Normal"; }}
Expand Down Expand Up @@ -233,6 +234,7 @@ keybinds clear-defaults=true {{
bind "w" {{ ToggleFloatingPanes; SwitchToMode "Normal"; }}
bind "e" {{ TogglePaneEmbedOrFloating; SwitchToMode "Normal"; }}
bind "c" {{ SwitchToMode "RenamePane"; PaneNameInput 0;}}
bind "i" {{ TogglePanePinned; SwitchToMode "Normal"; }}
}}
move {{
bind "{primary_modifier} h" {{ SwitchToMode "Normal"; }}
Expand Down Expand Up @@ -440,6 +442,7 @@ keybinds clear-defaults=true {{
bind "w" {{ ToggleFloatingPanes; SwitchToMode "Normal"; }}
bind "e" {{ TogglePaneEmbedOrFloating; SwitchToMode "Normal"; }}
bind "c" {{ SwitchToMode "RenamePane"; PaneNameInput 0;}}
bind "i" {{ TogglePanePinned; SwitchToMode "Normal"; }}
}}
move {{
bind "n" "Tab" {{ MovePane; }}
Expand Down Expand Up @@ -618,6 +621,7 @@ keybinds clear-defaults=true {{
bind "w" {{ ToggleFloatingPanes; SwitchToMode "Normal"; }}
bind "e" {{ TogglePaneEmbedOrFloating; SwitchToMode "Normal"; }}
bind "c" {{ SwitchToMode "RenamePane"; PaneNameInput 0;}}
bind "i" {{ TogglePanePinned; SwitchToMode "Normal"; }}
}}
move {{
bind "{primary_modifier} h" {{ SwitchToMode "Normal"; }}
Expand Down Expand Up @@ -805,6 +809,7 @@ keybinds clear-defaults=true {{
bind "w" {{ ToggleFloatingPanes; SwitchToMode "Normal"; }}
bind "e" {{ TogglePaneEmbedOrFloating; SwitchToMode "Normal"; }}
bind "c" {{ SwitchToMode "RenamePane"; PaneNameInput 0;}}
bind "i" {{ TogglePanePinned; SwitchToMode "Normal"; }}
}}
move {{
bind "n" "Tab" {{ MovePane; }}
Expand Down Expand Up @@ -967,6 +972,7 @@ keybinds clear-defaults=true {{
bind "w" {{ ToggleFloatingPanes; SwitchToMode "Normal"; }}
bind "e" {{ TogglePaneEmbedOrFloating; SwitchToMode "Normal"; }}
bind "c" {{ SwitchToMode "RenamePane"; PaneNameInput 0;}}
bind "i" {{ TogglePanePinned; SwitchToMode "Normal"; }}
}}
move {{
bind "{primary_modifier} m" {{ SwitchToMode "Normal"; }}
Expand Down
16 changes: 2 additions & 14 deletions default-plugins/configuration/src/presets_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,13 +533,7 @@ impl PresetsScreen {
} else {
(rows.saturating_sub(ui_size) / 2) + 2
};
print_nested_list_with_coordinates(
list_items,
left_padding,
top_coordinates,
Some(max_width),
None,
);
print_nested_list_with_coordinates(list_items, left_padding, top_coordinates, None, None);
}
fn render_second_bulletin(
&self,
Expand Down Expand Up @@ -672,13 +666,7 @@ impl PresetsScreen {
} else {
(rows.saturating_sub(ui_size) / 2) + 6
};
print_nested_list_with_coordinates(
list_items,
left_padding,
top_coordinates,
Some(max_width),
None,
);
print_nested_list_with_coordinates(list_items, left_padding, top_coordinates, None, None);
}
fn render_leader_keys_indication(
&self,
Expand Down
6 changes: 4 additions & 2 deletions default-plugins/configuration/src/rebind_leaders_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ impl RebindLeadersScreen {
} else {
(format!("{}", primary_modifier_key_text), 0)
};
let primary_modifier_menu_width = primary_modifier_text.chars().count();
print_text_with_coordinates(
Text::new(primary_modifier_text).color_range(3, primary_modifier_start_position..),
base_x,
Expand All @@ -330,7 +331,7 @@ impl RebindLeadersScreen {
.collect(),
base_x,
base_y + 6,
Some(screen_width / 2),
Some(primary_modifier_menu_width),
None,
);
}
Expand Down Expand Up @@ -504,6 +505,7 @@ impl RebindLeadersScreen {
(format!("{}", secondary_modifier_key_text), 0)
};
let secondary_modifier_menu_x_coords = base_x + (screen_width / 2);
let secondary_modifier_menu_width = secondary_modifier_text.chars().count();
print_text_with_coordinates(
Text::new(secondary_modifier_text).color_range(0, secondary_modifier_start_position..),
secondary_modifier_menu_x_coords,
Expand All @@ -530,7 +532,7 @@ impl RebindLeadersScreen {
.collect(),
secondary_modifier_menu_x_coords,
base_y + 6,
Some(screen_width / 2),
Some(secondary_modifier_menu_width),
None,
);
}
Expand Down
7 changes: 7 additions & 0 deletions default-plugins/session-manager/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ impl State {
// through the package)
self.show_error("Session name must be shorter than 108 bytes");
return;
} else if self.new_session_info.name().contains('/') {
self.show_error("Session name cannot contain '/'");
return;
}
self.new_session_info.handle_selection(&self.session_name);
},
Expand All @@ -483,6 +486,10 @@ impl State {
self.show_error("A resurrectable session by this name already exists.");
return; // s that we don't hide self
} else {
if renaming_session_name.contains('/') {
self.show_error("Session names cannot contain '/'");
return;
}
self.update_current_session_name_in_ui(&renaming_session_name);
rename_session(&renaming_session_name);
return; // s that we don't hide self
Expand Down
10 changes: 10 additions & 0 deletions default-plugins/session-manager/src/ui/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,16 @@ pub fn render_renaming_session_screen(
33 + new_session_name.width()..40 + new_session_name.width(),
);
print_text_with_coordinates(text, x, y, None, None);
if new_session_name.contains('/') {
let error_text = "Error: session name cannot contain '/'";
print_text_with_coordinates(
Text::new(error_text).color_range(3, ..),
x,
y + 2,
None,
None,
);
}
}

pub fn render_controls_line(
Expand Down
1 change: 1 addition & 0 deletions example/default.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ keybinds {
bind "w" { ToggleFloatingPanes; SwitchToMode "Normal"; }
bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "Normal"; }
bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;}
bind "i" { TogglePanePinned; SwitchToMode "Normal"; }
}
move {
bind "Ctrl h" { SwitchToMode "Normal"; }
Expand Down
50 changes: 50 additions & 0 deletions funding.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"version": "v1.0.0",
"entity": {
"type": "individual",
"role": "owner",
"name": "Aram Drevekenin",
"email": "aram@poor.dev",
"description": "An indie developer rethinking our terminal experience",
"webpageUrl": {
"url": "https://zellij.dev",
"wellKnown": "https://zellij.dev/.well-known/funding-manifest-urls"
}
},
"projects": [{
"guid": "zellij",
"name": "Zellij",
"description": "A terminal workspace with batteries included",
"webpageUrl": {
"url": "https://zellij.dev",
"wellKnown": "https://zellij.dev/.well-known/funding-manifest-urls"
},
"repositoryUrl": {
"url": "https://github.com/zellij-org/zellij"
},
"licenses": ["spdx:MIT"],
"tags": ["terminal", "linux", "macos", "developer-tools"]
}],
"funding": {
"channels": [
{
"guid": "github-sponsors",
"type": "other",
"address": "https://github.com/sponsors/imsnif",
"description": "My Github Sponsors page."
}
],
"plans": [
{
"guid": "sponsorship-plan",
"status": "active",
"name": "Sponsorship Plan",
"description": "Sponsor as you wish and are able (preferably in a recurring manner) to help me pay my bills!",
"amount": 0,
"currency": "USD",
"frequency": "other",
"channels": ["github-sponsors"]
}
]
}
}
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn main() {
y,
width,
height,
pinned,
})) = opts.command
{
let cwd = cwd.or_else(|| std::env::current_dir().ok());
Expand All @@ -57,6 +58,7 @@ fn main() {
y,
width,
height,
pinned,
};
commands::send_action_to_session(command_cli_action, opts.session, config);
std::process::exit(0);
Expand All @@ -71,6 +73,7 @@ fn main() {
y,
width,
height,
pinned,
})) = opts.command
{
let cwd = None;
Expand All @@ -90,6 +93,7 @@ fn main() {
y,
width,
height,
pinned,
};
commands::send_action_to_session(command_cli_action, opts.session, config);
std::process::exit(0);
Expand All @@ -105,6 +109,7 @@ fn main() {
y,
width,
height,
pinned,
})) = opts.command
{
let mut file = file;
Expand All @@ -125,6 +130,7 @@ fn main() {
y,
width,
height,
pinned,
};
commands::send_action_to_session(command_cli_action, opts.session, config);
std::process::exit(0);
Expand Down
97 changes: 97 additions & 0 deletions src/tests/e2e/cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2423,3 +2423,100 @@ pub fn load_plugins_in_background_on_startup() {
);
assert_snapshot!(last_snapshot);
}

#[test]
#[ignore]
pub fn pin_floating_panes() {
let fake_win_size = Size {
cols: 120,
rows: 24,
};
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
let mut runner = RemoteRunner::new(fake_win_size)
.add_step(Step {
name: "Toggle floating panes",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
if remote_terminal.status_bar_appears()
&& remote_terminal.cursor_position_is(3, 2)
{
remote_terminal.send_key(&PANE_MODE);
std::thread::sleep(std::time::Duration::from_millis(100));
remote_terminal.send_key(&TOGGLE_FLOATING_PANES);
step_is_complete = true;
}
step_is_complete
},
})
.add_step(Step {
name: "Pin floating pane",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
if remote_terminal.snapshot_contains("PIN [ ]") {
remote_terminal.send_key(&sgr_mouse_report(Position::new(8, 87), 0));
step_is_complete = true;
}
step_is_complete
},
})
.add_step(Step {
name: "Focus underlying pane",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
if remote_terminal.snapshot_contains("PIN [+]") {
remote_terminal.send_key(&PANE_MODE);
std::thread::sleep(std::time::Duration::from_millis(100));
remote_terminal.send_key(&TOGGLE_FLOATING_PANES);
step_is_complete = true;
}
step_is_complete
},
})
.add_step(Step {
name: "Fill tiled pane with text",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
if remote_terminal.cursor_position_is(3, 2) {
remote_terminal.load_fixture("e2e/fill_for_pinned_pane");
step_is_complete = true;
}
step_is_complete
},
})
.add_step(Step {
name: "Move cursor behind pinned pane",
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
if remote_terminal.snapshot_contains("line") {
remote_terminal
.send_key(&format!(" hide_me").as_bytes().to_vec());
step_is_complete = true;
}
step_is_complete
},
});

runner.run_all_steps();
let last_snapshot = runner.take_snapshot_after(Step {
name: "Wait for cursor to be behind pinned pane",
instruction: |remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
if remote_terminal.snapshot_contains("hide") {
// terminal has been filled with fixture text
step_is_complete = true;
}
step_is_complete
},
});
if runner.test_timed_out && test_attempts > 0 {
test_attempts -= 1;
continue;
} else {
break last_snapshot;
}
};
let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
Loading

0 comments on commit b3936a1

Please sign in to comment.