mirror of
https://github.com/wez/wezterm.git
synced 2024-11-28 01:06:37 +03:00
add CHA support, used by dialog
This commit is contained in:
parent
4b92a03c15
commit
8e9620d001
@ -438,6 +438,17 @@ impl<'a> Iterator for CSIParser<'a> {
|
||||
y: Position::Relative(0),
|
||||
}),
|
||||
|
||||
// CHA: Cursor Character Absolute
|
||||
('G', &[], Some(&[])) => Some(CSIAction::SetCursorXY {
|
||||
x: Position::Absolute(0),
|
||||
y: Position::Relative(0),
|
||||
}),
|
||||
// CHA: Cursor Character Absolute
|
||||
('G', &[], Some(&[col])) => Some(CSIAction::SetCursorXY {
|
||||
x: Position::Absolute(col.max(1) - 1),
|
||||
y: Position::Relative(0),
|
||||
}),
|
||||
|
||||
// H: Cursor Position (CUP)
|
||||
// f: Horizontal and vertical position (HVP)
|
||||
('H', &[], Some(&[])) | ('f', &[], Some(&[])) => Some(CSIAction::SetCursorXY {
|
||||
|
@ -95,3 +95,25 @@ fn test_dl() {
|
||||
term.delete_lines(-2);
|
||||
assert_visible_contents(&term, &["1", "2", "3"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cha() {
|
||||
let mut term = TestTerm::new(3, 4, 0);
|
||||
term.cup(1, 1);
|
||||
term.assert_cursor_pos(1, 1, None);
|
||||
|
||||
term.print("\x1b[G");
|
||||
term.assert_cursor_pos(0, 1, None);
|
||||
|
||||
term.print("\x1b[2G");
|
||||
term.assert_cursor_pos(1, 1, None);
|
||||
|
||||
term.print("\x1b[0G");
|
||||
term.assert_cursor_pos(0, 1, None);
|
||||
|
||||
term.print("\x1b[-1G");
|
||||
term.assert_cursor_pos(0, 1, None);
|
||||
|
||||
term.print("\x1b[100G");
|
||||
term.assert_cursor_pos(3, 1, None);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user