Permalink
Browse files

Improve parsing of nested control characters

  • Loading branch information...
jackpot51 committed Oct 31, 2017
1 parent 728c1e1 commit 2e4846b4aedcf750bd5e87818ef613ce3ae599cf
Showing with 14 additions and 6 deletions.
  1. +1 −1 Cargo.toml
  2. +13 −5 src/lib.rs
View
@@ -2,7 +2,7 @@
name = "ransid"
description = "Rust ANSI Driver"
repository = "https://github.com/jackpot51/ransid"
version = "0.3.7"
version = "0.3.8"
license-file = "LICENSE"
readme = "README.md"
keywords = ["redox", "ansi"]
View
@@ -821,7 +821,9 @@ impl Console {
}
match c {
'\x00' ... '\x06' => {}, // Ignore
'\x00' ... '\x06' => { // Ignore
println!("Ignored character {:?}", c);
},
'\x07' => {}, // FIXME: Add bell
'\x08' => { // Backspace
if self.x >= 1 {
@@ -835,15 +837,21 @@ impl Console {
self.x = 0;
self.y += 1;
},
'\x0B' ... '\x0C' => {} // Ignore
'\x0B' ... '\x0C' => { // Ignore
println!("Ignored character {:?}", c);
},
'\x0D' => { // Carriage Return
self.x = 0;
},
'\x0E' ... '\x1A' => {} // Ignore
'\x0E' ... '\x1A' => { // Ignore
println!("Ignored character {:?}", c);
},
'\x1B' => { // Escape
self.escape = true;
},
'\x1C' ... '\x1F' => {} // Ignore
'\x1C' ... '\x1F' => { // Ignore
println!("Ignored character {:?}", c);
},
' ' => { // Space
self.block(' ', callback);
@@ -903,7 +911,7 @@ impl Console {
};
if let Some(c) = c_opt {
if self.escape && c > '\x1F' {
if self.escape && (c < '\x08' || c > '\x0D') {
self.code(c, &mut callback);
} else {
self.character(c, &mut callback);

0 comments on commit 2e4846b

Please sign in to comment.