Escapes % when printing strings.

This commit is contained in:
Alexandre Bury 2015-05-28 17:37:00 -07:00
parent 6c6f929430
commit 8ee04c525f

View File

@ -35,8 +35,13 @@ impl Printer {
Some((i,_)) => &text[..i],
_ => text,
};
let p = p + self.offset;
ncurses::mvprintw(p.y as i32, p.x as i32, text);
if text.contains("%") {
ncurses::mvprintw(p.y as i32, p.x as i32, &text.replace("%", "%%"));
} else {
ncurses::mvprintw(p.y as i32, p.x as i32, text);
}
}
/// Prints a vertical line using the given character.