use super::*;
#[test]
fn hts_sets_custom_tab_stop() {
let mut parser = crate::Parser::new(TerminalSize { rows: 24, cols: 80 }, 0);
process(&mut parser, b"\x1b[3g\x1b[6G\x1bH\x1b[1G\t");
assert_eq!(parser.screen().cursor(), Position { row: 0, col: 5 });
}
#[test]
fn tbc_clears_at_cursor() {
let mut parser = crate::Parser::new(TerminalSize { rows: 24, cols: 80 }, 0);
process(&mut parser, b"\x1b[9G\x1b[0g\x1b[1G\t");
assert_eq!(parser.screen().cursor(), Position { row: 0, col: 16 });
}
#[test]
fn tbc_clears_all() {
let mut parser = crate::Parser::new(TerminalSize { rows: 24, cols: 80 }, 0);
process(&mut parser, b"\x1b[3g\t");
assert_eq!(parser.screen().cursor(), Position { row: 0, col: 79 });
}
#[test]
fn cht_forward_n() {
let mut parser = crate::Parser::new(TerminalSize { rows: 24, cols: 80 }, 0);
process(&mut parser, b"\x1b[3I");
assert_eq!(parser.screen().cursor(), Position { row: 0, col: 24 });
}
#[test]
fn cbt_backward() {
let mut parser = crate::Parser::new(TerminalSize { rows: 24, cols: 80 }, 0);
process(&mut parser, b"\x1b[21G\x1b[Z");
assert_eq!(parser.screen().cursor(), Position { row: 0, col: 16 });
}
#[test]
fn cbt_backward_n() {
let mut parser = crate::Parser::new(TerminalSize { rows: 24, cols: 80 }, 0);
process(&mut parser, b"\x1b[21G\x1b[2Z");
assert_eq!(parser.screen().cursor(), Position { row: 0, col: 8 });
}
#[test]
fn tab_stops_reset_by_ris() {
let mut parser = crate::Parser::new(TerminalSize { rows: 24, cols: 80 }, 0);
process(&mut parser, b"\x1b[3g\x1bc\t");
assert_eq!(parser.screen().cursor(), Position { row: 0, col: 8 });
}