summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2022-03-23 09:08:35 +0100
committerGitHub <noreply@github.com>2022-03-23 09:08:35 +0100
commit7141779153743cb98771c6582a1feff32ec2e494 (patch)
treebf30b37263858d5e166caa226ffadbb1e53c8c0f /src
parentd394617a3d13e5069258042cce466c9eb43d0c14 (diff)
chore(deps): move from termion to termwiz for STDIN handling (#1249)
* fix(deps): switch from termion to termwiz for STDIN parsing * style(fmt): clippy * style(fmt): moar clippy * style(fmt): rustfmt * fix(tests): e2e mouse press * style(fmt): rustfmt * bring back polling * fmt fmt fmt * fix some e2e flakiness
Diffstat (limited to 'src')
-rw-r--r--src/tests/e2e/cases.rs29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/tests/e2e/cases.rs b/src/tests/e2e/cases.rs
index 8bb4d8980..19579f55a 100644
--- a/src/tests/e2e/cases.rs
+++ b/src/tests/e2e/cases.rs
@@ -58,15 +58,16 @@ pub const BRACKETED_PASTE_START: [u8; 6] = [27, 91, 50, 48, 48, 126]; // \u{1b}[
pub const BRACKETED_PASTE_END: [u8; 6] = [27, 91, 50, 48, 49, 126]; // \u{1b}[201
pub const SLEEP: [u8; 0] = [];
-// simplified, slighty adapted version of alacritty mouse reporting code
-pub fn normal_mouse_report(position: Position, button: u8) -> Vec<u8> {
+pub fn sgr_mouse_report(position: Position, button: u8) -> Vec<u8> {
+ // button: (release is with lower case m, not supported here yet)
+ // 0 => left click
+ // 2 => right click
+ // 64 => scroll up
+ // 65 => scroll down
let Position { line, column } = position;
-
- let mut command = vec![b'\x1b', b'[', b'M', 32 + button];
- command.push(32 + 1 + column.0 as u8);
- command.push(32 + 1 + line.0 as u8);
-
- command
+ format!("\u{1b}[<{};{};{}M", button, column.0, line.0)
+ .as_bytes()
+ .to_vec()
}
// All the E2E tests are marked as "ignored" so that they can be run separately from the normal
@@ -247,7 +248,9 @@ pub fn scrolling_inside_a_pane() {
write!(&mut content_to_send, "{:0<58}", "line19 ").unwrap();
write!(&mut content_to_send, "{:0<57}", "line20 ").unwrap();
+ remote_terminal.send_key(&BRACKETED_PASTE_START);
remote_terminal.send_key(content_to_send.as_bytes());
+ remote_terminal.send_key(&BRACKETED_PASTE_END);
step_is_complete = true;
}
@@ -1030,7 +1033,7 @@ fn focus_pane_with_mouse() {
instruction: |mut remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
if remote_terminal.cursor_position_is(63, 2) && remote_terminal.tip_appears() {
- remote_terminal.send_key(&normal_mouse_report(Position::new(5, 2), 0));
+ remote_terminal.send_key(&sgr_mouse_report(Position::new(5, 2), 0));
step_is_complete = true;
}
step_is_complete
@@ -1121,7 +1124,7 @@ pub fn scrolling_inside_a_pane_with_mouse() {
let mut step_is_complete = false;
if remote_terminal.cursor_position_is(118, 20) {
// all lines have been written to the pane
- remote_terminal.send_key(&normal_mouse_report(Position::new(2, 64), 64));
+ remote_terminal.send_key(&sgr_mouse_report(Position::new(2, 64), 64));
step_is_complete = true;
}
step_is_complete
@@ -1638,8 +1641,10 @@ pub fn bracketed_paste() {
remote_terminal.send_key(&BRACKETED_PASTE_START);
remote_terminal.send_key(&TAB_MODE);
remote_terminal.send_key(&NEW_TAB_IN_TAB_MODE);
+ remote_terminal.send_key("a".as_bytes());
+ remote_terminal.send_key("b".as_bytes());
+ remote_terminal.send_key("c".as_bytes());
remote_terminal.send_key(&BRACKETED_PASTE_END);
- remote_terminal.send_key("abc".as_bytes());
step_is_complete = true;
}
step_is_complete
@@ -1651,7 +1656,7 @@ pub fn bracketed_paste() {
name: "Wait for terminal to render sent keys",
instruction: |remote_terminal: RemoteTerminal| -> bool {
let mut step_is_complete = false;
- if remote_terminal.cursor_position_is(9, 2) {
+ if remote_terminal.snapshot_contains("abc") {
// text has been entered into the only terminal pane
step_is_complete = true;
}