zellij/zellij-server/src/panes/unit/terminal_pane_tests.rs
Aram Drevekenin 821e7cbc5a
feat(ui): add floating panes (#1066)
* basic functionality

* close and reopen scratch terminal working

* embed/float and resize whole tab for floating and static floating panes

* move focus working

* fix focus change in floating panes

* move pane with mouse

* floating z indices

* tests and better resize algorithm

* starting to work on performance

* some performance experimentations

* new render engine

* reverse painters algorithm for floating panes

* fix frame buffering

* improve ux situation

* handle multiple new panes on screen without overlap

* adjust keybindings

* adjust key hints

* fix multiuser frame ui

* fix various floating/multiuser bugs

* remove stuff

* wide characters under floating panes

* fix wide character frame override

* fix non-frame boundaries interactions with floating panes

* fix selection character width

* fix title frame wide char overflow

* fix existing tests

* add tests

* refactor output out of tab

* refactor floating panes out of tab

* refactor tab

* moar refactoring

* refactorings and bring back terminal window title setting

* add frame vte output

* remove more unused stuff

* remove even more unused stuff

* you know the drill

* refactor floating panes and remove more stuffs

* refactor pane grids

* remove unused output caching

* refactor output

* remove unused stuff

* rustfmt

* some formatting

* rustfmt

* reduce clippy to normal

* remove comment

* remove unused

* fix closign pane

* fix tests
2022-02-18 21:10:06 +01:00

40 lines
1.2 KiB
Rust

use super::super::TerminalPane;
use crate::panes::LinkHandler;
use crate::tab::Pane;
use ::insta::assert_snapshot;
use std::cell::RefCell;
use std::rc::Rc;
use zellij_utils::pane_size::PaneGeom;
use zellij_utils::zellij_tile::data::Palette;
use std::fmt::Write;
#[test]
pub fn scrolling_inside_a_pane() {
let fake_client_id = 1;
let mut fake_win_size = PaneGeom::default();
fake_win_size.cols.set_inner(121);
fake_win_size.rows.set_inner(20);
let pid = 1;
let palette = Palette::default();
let mut terminal_pane = TerminalPane::new(
pid,
fake_win_size,
palette,
0,
String::new(),
Rc::new(RefCell::new(LinkHandler::new())),
); // 0 is the pane index
let mut text_to_fill_pane = String::new();
for i in 0..30 {
writeln!(&mut text_to_fill_pane, "\rline {}", i + 1).unwrap();
}
terminal_pane.handle_pty_bytes(text_to_fill_pane.into_bytes());
terminal_pane.scroll_up(10, fake_client_id);
assert_snapshot!(format!("{:?}", terminal_pane.grid));
terminal_pane.scroll_down(3, fake_client_id);
assert_snapshot!(format!("{:?}", terminal_pane.grid));
terminal_pane.clear_scroll();
assert_snapshot!(format!("{:?}", terminal_pane.grid));
}