summaryrefslogtreecommitdiff
path: root/src/term.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/term.rs')
-rw-r--r--src/term.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/term.rs b/src/term.rs
index 2838c668..5b00acfd 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -149,6 +149,11 @@ impl Term {
/// Set character in current cursor position
fn set_char(&mut self, c: char) {
+ if self.cursor.x == self.grid.num_cols() as u16 {
+ self.cursor.y += 1;
+ self.cursor.x = 0;
+ }
+
let cell = &mut self.grid[self.cursor];
cell.c = c;
cell.fg = self.fg;
@@ -175,8 +180,17 @@ impl ansi::Handler for Term {
println!("goto: x={}, y={}", x, y);
self.cursor.goto(x as u16, y as u16);
}
- fn goto_row(&mut self, y: i64) { println!("goto_row: {}", y); }
- fn goto_col(&mut self, x: i64) { println!("goto_col: {}", x); }
+ fn goto_row(&mut self, y: i64) {
+ println!("goto_row: {}", y);
+ let x = self.cursor_x();
+ self.cursor.goto(x, y as u16);
+ }
+ fn goto_col(&mut self, x: i64) {
+ println!("goto_col: {}", x);
+ let y = self.cursor_y();
+ self.cursor.goto(x as u16, y);
+ }
+
fn insert_blank(&mut self, num: i64) { println!("insert_blank: {}", num); }
fn move_up(&mut self, rows: i64) {
@@ -325,6 +339,12 @@ impl ansi::Handler for Term {
Attr::Background(named_color) => {
self.bg = COLORS[named_color as usize];
},
+ Attr::ForegroundSpec(rgb) => {
+ self.fg = rgb;
+ },
+ Attr::BackgroundSpec(rgb) => {
+ self.bg = rgb;
+ },
Attr::Reset => {
self.fg = DEFAULT_FG;
self.bg = DEFAULT_BG;