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,9 +35,14 @@ impl Printer {
Some((i,_)) => &text[..i],
_ => text,
};
let p = p + self.offset;
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.
pub fn print_vline<T: ToVec2>(&self, start: T, len: usize, c: u64) {