mirror of
https://github.com/wez/wezterm.git
synced 2024-12-01 00:35:46 +03:00
vttest: respect dec auto wrap mode
refs: https://github.com/wez/wezterm/issues/133
This commit is contained in:
parent
2de60e3791
commit
1bb39835c0
@ -1062,22 +1062,18 @@ impl TerminalState {
|
||||
|
||||
Mode::SetDecPrivateMode(DecPrivateMode::Code(DecPrivateModeCode::AutoWrap)) => {
|
||||
self.dec_auto_wrap = true;
|
||||
log::error!("dec_auto_wrap -> {}", self.dec_auto_wrap);
|
||||
}
|
||||
|
||||
Mode::ResetDecPrivateMode(DecPrivateMode::Code(DecPrivateModeCode::AutoWrap)) => {
|
||||
self.dec_auto_wrap = false;
|
||||
log::error!("dec_auto_wrap -> {}", self.dec_auto_wrap);
|
||||
}
|
||||
|
||||
Mode::SetDecPrivateMode(DecPrivateMode::Code(DecPrivateModeCode::OriginMode)) => {
|
||||
self.dec_origin_mode = true;
|
||||
log::error!("dec_origin_mode -> {}", self.dec_origin_mode);
|
||||
}
|
||||
|
||||
Mode::ResetDecPrivateMode(DecPrivateMode::Code(DecPrivateModeCode::OriginMode)) => {
|
||||
self.dec_origin_mode = false;
|
||||
log::error!("dec_origin_mode -> {}", self.dec_origin_mode);
|
||||
}
|
||||
|
||||
Mode::SetDecPrivateMode(DecPrivateMode::Code(DecPrivateModeCode::SmoothScroll))
|
||||
@ -1670,7 +1666,7 @@ impl<'a> Performer<'a> {
|
||||
self.cursor.x += print_width;
|
||||
self.wrap_next = false;
|
||||
} else {
|
||||
self.wrap_next = true;
|
||||
self.wrap_next = self.dec_auto_wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,10 +107,14 @@ impl TestTerm {
|
||||
let clip: Arc<dyn Clipboard> = Arc::new(LocalClip::new());
|
||||
term.set_clipboard(&clip);
|
||||
|
||||
Self {
|
||||
let mut term = Self {
|
||||
term,
|
||||
host: TestHost::new(),
|
||||
}
|
||||
};
|
||||
|
||||
term.set_auto_wrap(true);
|
||||
|
||||
term
|
||||
}
|
||||
|
||||
fn print<B: AsRef<[u8]>>(&mut self, bytes: B) {
|
||||
@ -124,6 +128,10 @@ impl TestTerm {
|
||||
self.print(if enable { b"h" } else { b"l" });
|
||||
}
|
||||
|
||||
fn set_auto_wrap(&mut self, enable: bool) {
|
||||
self.set_mode("?7", enable);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn set_scroll_region(&mut self, top: usize, bottom: usize) {
|
||||
self.print(CSI);
|
||||
@ -326,6 +334,25 @@ fn assert_all_contents(term: &Terminal, file: &str, line: u32, expect_lines: &[&
|
||||
fn basic_output() {
|
||||
let mut term = TestTerm::new(5, 10, 0);
|
||||
|
||||
term.cup(1, 1);
|
||||
|
||||
term.set_auto_wrap(false);
|
||||
term.print("hello, world!");
|
||||
assert_visible_contents(
|
||||
&term,
|
||||
file!(),
|
||||
line!(),
|
||||
&[
|
||||
" ",
|
||||
" hello, w!",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
],
|
||||
);
|
||||
|
||||
term.set_auto_wrap(true);
|
||||
term.erase_in_display(EraseInDisplay::EraseToStartOfDisplay);
|
||||
term.cup(1, 1);
|
||||
term.print("hello, world!");
|
||||
assert_visible_contents(
|
||||
|
Loading…
Reference in New Issue
Block a user