aboutsummaryrefslogtreecommitdiffstats
path: root/tests/control.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-28 14:57:07 -0500
committerJesse Luehrs <doy@tozt.net>2019-12-05 12:54:34 -0500
commit971b744c9c7c2c3dc9f055f69c5630ca11f0a09e (patch)
tree8b8c8e88d6dbd809cc6bcd5a82ef512c6e3d9f65 /tests/control.rs
parent42b25717605bcb8206f71722f09d02ef4b4275f2 (diff)
downloadvt100-rust-971b744c9c7c2c3dc9f055f69c5630ca11f0a09e.tar.gz
vt100-rust-971b744c9c7c2c3dc9f055f69c5630ca11f0a09e.zip
fix a couple more issues with end of line behavior
Diffstat (limited to 'tests/control.rs')
-rw-r--r--tests/control.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/control.rs b/tests/control.rs
index e0dc276..74e8d9c 100644
--- a/tests/control.rs
+++ b/tests/control.rs
@@ -97,6 +97,21 @@ fn lf_with(b: u8) {
assert_eq!(parser.screen().cell(1, 5).unwrap().contents(), "r");
assert_eq!(parser.screen().cell(1, 6).unwrap().contents(), "");
assert_eq!(parser.screen().contents(), "foo\n bar");
+
+ parser.process(b"\x1b[H\x1b[J\x1b[4;80H");
+ assert_eq!(parser.screen().cursor_position(), (3, 79));
+ parser.process(b"a");
+ assert_eq!(parser.screen().cursor_position(), (3, 80));
+
+ // note: this is a behavior that terminals disagree on - xterm and urxvt
+ // would leave the cursor at (4, 79) here, but alacritty, tmux, and screen
+ // put it at (4, 80). in general, i'm aiming for roughly tmux/screen
+ // compat where possible, so that's what i'm going with here.
+ parser.process(&[b]);
+ assert_eq!(parser.screen().cursor_position(), (4, 80));
+
+ parser.process(b"b");
+ assert_eq!(parser.screen().cursor_position(), (5, 1));
}
#[test]