Skip to content

Commit b0bd3e1

Browse files
authored
fix: fullscreen floating pane editor (#5528)
* fix: fullscreen floating pane editor * add pr
1 parent d8e58e4 commit b0bd3e1

3 files changed

Lines changed: 123 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
99
* fix: some issues with notification parsing (eg. neovim notification on save) (https://github.com/zellij-org/zellij/pull/5523)
1010
* fix: kitty image size on startup and clearing with stacked unlisted full framed panes (https://github.com/zellij-org/zellij/pull/5526)
1111
* fix: focus event in remote attach (https://github.com/zellij-org/zellij/pull/5527)
12+
* fix: editing scrollback issue with a fullscreen floating pane (https://github.com/zellij-org/zellij/pull/5528)
1213

1314
## [0.45.0] - 2026-08-20
1415
* feat: allow tabs to have different sizes if clients aren't focused on the same one (https://github.com/zellij-org/zellij/pull/5133)

zellij-server/src/panes/floating_panes/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,17 @@ impl FloatingPanes {
212212
.and_then(|removed_pane| {
213213
let removed_pane_id = removed_pane.pid();
214214
let with_pane_id = with_pane.pid();
215-
let removed_pane_geom = removed_pane.current_geom();
215+
let removed_pane_geom = removed_pane.position_and_size();
216+
let removed_pane_geom_override = removed_pane.geom_override();
216217
with_pane.set_geom(removed_pane_geom);
218+
match removed_pane_geom_override {
219+
Some(geom_override) => with_pane.set_geom_override(geom_override),
220+
None => with_pane.reset_size_and_position_override(),
221+
};
217222
self.panes.insert(with_pane_id, with_pane);
223+
if self.fullscreen_pane_id == Some(pane_id) {
224+
self.fullscreen_pane_id = Some(with_pane_id);
225+
}
218226
let z_index = self
219227
.z_indices
220228
.iter()

zellij-server/src/tab/unit/tab_tests.rs

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,6 +2429,119 @@ pub fn opening_scrollback_editor_on_fullscreen_pane_retargets_fullscreen() {
24292429
}
24302430
}
24312431

2432+
#[test]
2433+
pub fn opening_scrollback_editor_on_fullscreen_floating_pane_retargets_fullscreen() {
2434+
let client_id = 1;
2435+
let mut tab = create_tab_with_two_floating_panes();
2436+
let viewport = *tab.viewport.borrow();
2437+
let active_pane_id = tab
2438+
.floating_panes
2439+
.active_pane_id(client_id)
2440+
.expect("a floating pane is focused");
2441+
let original_geom = tab
2442+
.floating_panes
2443+
.get(&active_pane_id)
2444+
.expect("focused floating pane exists")
2445+
.position_and_size();
2446+
2447+
tab.toggle_active_pane_fullscreen(client_id);
2448+
assert_eq!(
2449+
tab.floating_panes.fullscreen_pane_id(),
2450+
Some(active_pane_id),
2451+
"fullscreen tracks the original floating pane",
2452+
);
2453+
2454+
let editor_pane_id = PaneId::Terminal(99);
2455+
tab.replace_active_pane_with_editor_pane(editor_pane_id, client_id)
2456+
.unwrap();
2457+
assert_eq!(
2458+
tab.floating_panes.fullscreen_pane_id(),
2459+
Some(editor_pane_id),
2460+
"fullscreen now tracks the editor pane id, not the suppressed one",
2461+
);
2462+
let editor_geom = floating_pane_geom(&tab, editor_pane_id);
2463+
assert_eq!(
2464+
editor_geom.cols.as_usize(),
2465+
viewport.cols,
2466+
"the editor pane covers the viewport cols",
2467+
);
2468+
assert_eq!(
2469+
editor_geom.rows.as_usize(),
2470+
viewport.rows,
2471+
"the editor pane covers the viewport rows",
2472+
);
2473+
2474+
tab.toggle_active_pane_fullscreen(client_id);
2475+
assert!(
2476+
!tab.floating_panes.fullscreen_is_active(),
2477+
"fullscreen is cleared after the second toggle",
2478+
);
2479+
let editor_pane = tab
2480+
.floating_panes
2481+
.get(&editor_pane_id)
2482+
.expect("editor pane is present in floating panes");
2483+
assert!(
2484+
editor_pane.geom_override().is_none(),
2485+
"editor pane no longer carries the fullscreen geom_override",
2486+
);
2487+
assert_eq!(
2488+
editor_pane.position_and_size(),
2489+
original_geom,
2490+
"editor pane falls back to the replaced pane's original geometry",
2491+
);
2492+
}
2493+
2494+
#[test]
2495+
pub fn closing_fullscreen_floating_scrollback_editor_restores_geometry() {
2496+
let client_id = 1;
2497+
let mut tab = create_tab_with_two_floating_panes();
2498+
let active_pane_id = tab
2499+
.floating_panes
2500+
.active_pane_id(client_id)
2501+
.expect("a floating pane is focused");
2502+
let original_geom = tab
2503+
.floating_panes
2504+
.get(&active_pane_id)
2505+
.expect("focused floating pane exists")
2506+
.position_and_size();
2507+
2508+
let editor_pane_id = PaneId::Terminal(99);
2509+
tab.replace_active_pane_with_editor_pane(editor_pane_id, client_id)
2510+
.unwrap();
2511+
tab.toggle_active_pane_fullscreen(client_id);
2512+
assert_eq!(
2513+
tab.floating_panes.fullscreen_pane_id(),
2514+
Some(editor_pane_id),
2515+
"fullscreen tracks the editor pane",
2516+
);
2517+
2518+
tab.close_pane(editor_pane_id, false, None);
2519+
assert_eq!(
2520+
tab.floating_panes.fullscreen_pane_id(),
2521+
Some(active_pane_id),
2522+
"fullscreen now tracks the restored suppressed pane",
2523+
);
2524+
2525+
tab.toggle_active_pane_fullscreen(client_id);
2526+
assert!(
2527+
!tab.floating_panes.fullscreen_is_active(),
2528+
"fullscreen is cleared after the second toggle",
2529+
);
2530+
let restored_pane = tab
2531+
.floating_panes
2532+
.get(&active_pane_id)
2533+
.expect("restored pane is present");
2534+
assert!(
2535+
restored_pane.geom_override().is_none(),
2536+
"restored pane no longer carries the fullscreen geom_override",
2537+
);
2538+
assert_eq!(
2539+
restored_pane.position_and_size(),
2540+
original_geom,
2541+
"restored pane is back to its original geometry",
2542+
);
2543+
}
2544+
24322545
#[test]
24332546
fn switch_to_next_pane_fullscreen() {
24342547
let size = Size {

0 commit comments

Comments
 (0)