diff options
| author | Aram Drevekenin <aram@poor.dev> | 2021-05-12 14:22:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-12 14:22:15 +0200 |
| commit | 3f1ec7c29590fea0805e7effb605548606b58306 (patch) | |
| tree | 7f4d622d9c945225f21b4d8f15090ca6e0223a27 /src/tests/integration/basic.rs | |
| parent | docs(changelog): compatibility update (diff) | |
| download | sl0ppij-3f1ec7c29590fea0805e7effb605548606b58306.tar.gz sl0ppij-3f1ec7c29590fea0805e7effb605548606b58306.tar.xz sl0ppij-3f1ec7c29590fea0805e7effb605548606b58306.zip | |
fix(ui): handle pasted text properly (#494)
* fix(ui): handle pasted text properly
* style(fmt): rustfmt
Diffstat (limited to 'src/tests/integration/basic.rs')
| -rw-r--r-- | src/tests/integration/basic.rs | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs index c8305cab..5b72dbfe 100644 --- a/src/tests/integration/basic.rs +++ b/src/tests/integration/basic.rs @@ -4,10 +4,10 @@ use ::insta::assert_snapshot; use crate::common::input::config::Config; use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::commands::{ - PANE_MODE, QUIT, SCROLL_DOWN_IN_SCROLL_MODE, SCROLL_MODE, SCROLL_PAGE_DOWN_IN_SCROLL_MODE, - SCROLL_PAGE_UP_IN_SCROLL_MODE, SCROLL_UP_IN_SCROLL_MODE, SPAWN_TERMINAL_IN_PANE_MODE, - SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE, - TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE, + BRACKETED_PASTE_END, BRACKETED_PASTE_START, PANE_MODE, QUIT, SCROLL_DOWN_IN_SCROLL_MODE, + SCROLL_MODE, SCROLL_PAGE_DOWN_IN_SCROLL_MODE, SCROLL_PAGE_UP_IN_SCROLL_MODE, + SCROLL_UP_IN_SCROLL_MODE, SPAWN_TERMINAL_IN_PANE_MODE, SPLIT_DOWN_IN_PANE_MODE, + SPLIT_RIGHT_IN_PANE_MODE, TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE, }; use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}; use crate::{start, CliArgs}; @@ -441,3 +441,43 @@ pub fn toggle_focused_pane_fullscreen() { get_next_to_last_snapshot(snapshots).expect("could not find snapshot"); assert_snapshot!(snapshot_before_quit); } + +#[test] +pub fn bracketed_paste() { + // bracketed paste (https://xfree86.org/current/ctlseqs.html#Bracketed%20Paste%20Mode) + // makes sure that text the user pastes is not interpreted as commands by the running program + // (zellij in this case) + // this tests makes sure the "SPLIT_RIGHT_IN_PANE_MODE" command is not interpreted as Zellij, + // since it's inside a bracketed paste block, while the "QUIT" command is, since it is already + // past the block + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, + ..Default::default() + }; + let mut fake_input_output = get_fake_os_input(&fake_win_size); + fake_input_output.add_terminal_input(&[ + &PANE_MODE, + &BRACKETED_PASTE_START, + &SPLIT_RIGHT_IN_PANE_MODE, + &BRACKETED_PASTE_END, + &QUIT, + ]); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + Config::default(), + ); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); + let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); + let snapshot_before_quit = + get_next_to_last_snapshot(snapshots).expect("could not find snapshot"); + assert_snapshot!(snapshot_before_quit); +} |
