aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-25 00:22:39 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-25 00:22:39 -0400
commitfbdfec3cb1a2b9eaf383dd47fa1d54ccf501f4fa (patch)
treee2587aea316f571a7c64f618b8542c57c83bf6ad
parentf72add79bdc4b72a54fb72e512d3a15263e7484c (diff)
downloadrunes-fbdfec3cb1a2b9eaf383dd47fa1d54ccf501f4fa.tar.gz
runes-fbdfec3cb1a2b9eaf383dd47fa1d54ccf501f4fa.zip
implement some of the screen clearing functions
-rw-r--r--src/screen.c54
1 files changed, 42 insertions, 12 deletions
diff --git a/src/screen.c b/src/screen.c
index b8e903a..3d358b7 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -87,38 +87,68 @@ void runes_screen_move_to(RunesTerm *t, int row, int col)
void runes_screen_clear_screen(RunesTerm *t)
{
- UNUSED(t);
- fprintf(stderr, "clear_screen nyi\n");
+ RunesScreen *scr = &t->scr;
+ int r;
+
+ for (r = 0; r < scr->max.row; ++r) {
+ memset(
+ scr->rows[r].cells, 0, scr->max.col * sizeof(struct runes_cell));
+ }
}
void runes_screen_clear_screen_forward(RunesTerm *t)
{
- UNUSED(t);
- fprintf(stderr, "clear_screen_forward nyi\n");
+ RunesScreen *scr = &t->scr;
+ int r;
+
+ memset(
+ &scr->rows[scr->cur.row].cells[scr->cur.col], 0,
+ (scr->max.col - scr->cur.col) * sizeof(struct runes_cell));
+ for (r = scr->cur.row + 1; r < scr->max.row; ++r) {
+ memset(
+ scr->rows[r].cells, 0, scr->max.col * sizeof(struct runes_cell));
+ }
}
void runes_screen_clear_screen_backward(RunesTerm *t)
{
- UNUSED(t);
- fprintf(stderr, "clear_screen_backward nyi\n");
+ RunesScreen *scr = &t->scr;
+ int r;
+
+ for (r = 0; r < scr->cur.row - 1; ++r) {
+ memset(
+ scr->rows[r].cells, 0, scr->max.col * sizeof(struct runes_cell));
+ }
+ memset(
+ scr->rows[scr->cur.row].cells, 0,
+ scr->cur.col * sizeof(struct runes_cell));
}
void runes_screen_kill_line(RunesTerm *t)
{
- UNUSED(t);
- fprintf(stderr, "kill_line nyi\n");
+ RunesScreen *scr = &t->scr;
+
+ memset(
+ scr->rows[scr->cur.row].cells, 0,
+ scr->max.col * sizeof(struct runes_cell));
}
void runes_screen_kill_line_forward(RunesTerm *t)
{
- UNUSED(t);
- fprintf(stderr, "kill_line_forward nyi\n");
+ RunesScreen *scr = &t->scr;
+
+ memset(
+ &scr->rows[scr->cur.row].cells[scr->cur.col], 0,
+ (scr->max.col - scr->cur.col) * sizeof(struct runes_cell));
}
void runes_screen_kill_line_backward(RunesTerm *t)
{
- UNUSED(t);
- fprintf(stderr, "kill_line_backward nyi\n");
+ RunesScreen *scr = &t->scr;
+
+ memset(
+ scr->rows[scr->cur.row].cells, 0,
+ scr->cur.col * sizeof(struct runes_cell));
}
void runes_screen_insert_characters(RunesTerm *t, int count)