Skip to content

Commit

Permalink
Ignore time delay in terminfo to avoid garbage
Browse files Browse the repository at this point in the history
The current parser does not support a time delay feature in terminfo.
This commit adds a state to the parser state machine during terminfo
field expansion to prevent printing this unsupported feature.
  • Loading branch information
Zachery Casey committed Sep 19, 2018
1 parent 04cacee commit 8f46bf2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/terminfo/parm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::iter::repeat;
#[derive(Clone, Copy, PartialEq)]
enum States {
Nothing,
Delay,
Percent,
SetVar,
GetVar,
Expand Down Expand Up @@ -164,10 +165,18 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) -> Result<Vec<
Nothing => {
if cur == '%' {
state = Percent;
} else if cur == '$' {
state = Delay;
} else {
output.push(c);
}
}
Delay => {
old_state = Nothing;
if cur == '>' {
state = Nothing;
}
}
Percent => {
match cur {
'%' => {
Expand Down
Binary file added tests/data/vt100
Binary file not shown.

0 comments on commit 8f46bf2

Please sign in to comment.