* relayout working with hard coded layout * work * refactor(layout): PaneLayout => TiledPaneLayout * tests passing * tests passing * tests passing * stacked panes and passing tests * tests for stacked panes * refactor(panes): stacked panes * fix: focusing into stacked panes from the left/right * fix(layouts): handle stacked layouts in the middle of the screen * fix(pane-stack): focus correctly when coming to stack from above/below * fix(stacked-panes): resize stack * fix(stacked-panes): focus with mouse * fix(stacked-panes): focus next pane * fix(layout-applier): sane focus order * fix(stacked-panes): better titles for one-liners * fix(stacked-panes): handle moving pane location in stack * fix(relayout): properly calculate display area * fix(relayout): properly calculate rounding errors * fix(stacked-panes): properly handle closing a pane near a stack * fix(swap-layouts): adjust swap layout sort order * feat(swap-layouts): ui + ux * fix(swap-layouts): include base layout * refactor(layout): remove unused method * fix(swap-layouts): respect pane contents and focus * work * fix(swap-layouts): load swap layouts from external file * fix(swap-layouts): properly truncate layout children * fix(stacked-panes): allow stacked panes to become fullscreen * fix(swap-layouts): work with multiple tabs * fix(swap-layouts): embed/eject panes properly with auto-layout * fix(stacked-panes): close last pane in stack * fix(stacked-panes): move focus for all clients in stack * fix(floating-panes): set layout damaged when moving panes * fix(relayout): move out of unfitting layout when resizing whole tab * fix(ui): background color for swap layout indicator * fix(keybinds): add switch next layout in tmux * fix(ui): swap layout indication in compact layout * fix(compact): correct swap constraint * fix(tests): tmux swap config shortcut * fix(resizes): cache resizes so as not to confuse panes (eg. vim) with multiple resizes that it debounces weirdly * feat(cli): dump swap layouts * fix(ui): stacked panes without pane frames * fix(ux): move pane forward/backwards also with floating panes * refactor(lint): remove unused stuff * refactor(tab): move swap layouts to separate file * style(fmt): rustfmt * style(fmt): rustfmt * refactor(panes): various cleanups * chore(deps): upgrade termwiz to get alt left-bracket * fix(assets): merge conflicts of binary files * style(fmt): rustfmt * style(clippy): no thank you! * chore(repo): remove garbage file
51 lines
1.2 KiB
Rust
51 lines
1.2 KiB
Rust
use super::*;
|
|
|
|
use nix::{pty::openpty, unistd::close};
|
|
|
|
struct TestTerminal {
|
|
openpty: OpenptyResult,
|
|
}
|
|
|
|
impl TestTerminal {
|
|
pub fn new() -> TestTerminal {
|
|
let openpty = openpty(None, None).expect("Could not create openpty");
|
|
TestTerminal { openpty }
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
pub fn master(&self) -> RawFd {
|
|
self.openpty.master
|
|
}
|
|
|
|
pub fn slave(&self) -> RawFd {
|
|
self.openpty.slave
|
|
}
|
|
}
|
|
|
|
impl Drop for TestTerminal {
|
|
fn drop(&mut self) {
|
|
close(self.openpty.master).expect("Failed to close the master");
|
|
close(self.openpty.slave).expect("Failed to close the slave");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn get_cwd() {
|
|
let test_terminal = TestTerminal::new();
|
|
let test_termios =
|
|
termios::tcgetattr(test_terminal.slave()).expect("Could not configure the termios");
|
|
|
|
let server = ServerOsInputOutput {
|
|
orig_termios: Arc::new(Mutex::new(test_termios)),
|
|
client_senders: Arc::default(),
|
|
terminal_id_to_raw_fd: Arc::default(),
|
|
cached_resizes: Arc::default(),
|
|
};
|
|
|
|
let pid = nix::unistd::getpid();
|
|
assert!(
|
|
server.get_cwd(pid).is_some(),
|
|
"Get current working directory from PID {}",
|
|
pid
|
|
);
|
|
}
|