diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-04-23 19:17:00 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-04-23 19:21:54 -0400 |
commit | f8329615c7b7b2697d3ccfd227b711ff60dc53b7 (patch) | |
tree | f1bde29660ba18d1642980ef22a355c2a39095b0 | |
parent | 219bed8179b62db44b3a55e445733dcd9feed785 (diff) | |
download | runes-f8329615c7b7b2697d3ccfd227b711ff60dc53b7.tar.gz runes-f8329615c7b7b2697d3ccfd227b711ff60dc53b7.zip |
be more consistent
-rw-r--r-- | src/display.c | 8 | ||||
-rw-r--r-- | src/parser.c | 4 | ||||
-rw-r--r-- | src/parser.l | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/display.c b/src/display.c index e8483f4..df57df7 100644 --- a/src/display.c +++ b/src/display.c @@ -497,10 +497,10 @@ void runes_display_use_normal_buffer(RunesTerm *t) void runes_display_set_scroll_region( RunesTerm *t, int top, int bottom, int left, int right) { - top = (top < 1 ? 1 : top) - 1; - bottom = (bottom > t->rows ? t->rows : bottom) - 1; - left = (left < 1 ? 1 : left) - 1; - right = (right > t->cols ? t->cols : right) - 1; + top = top < 0 ? 0 : top; + bottom = bottom > t->rows - 1 ? t->rows - 1 : bottom; + left = left < 0 ? 0 : left; + right = right > t->cols - 1 ? t->cols - 1 : right; if (left != 0 || right != t->cols - 1) { fprintf(stderr, "vertical scroll regions not yet supported\n"); diff --git a/src/parser.c b/src/parser.c index 8ea5e8e..8651128 100644 --- a/src/parser.c +++ b/src/parser.c @@ -2429,7 +2429,7 @@ static void runes_parser_handle_ri(RunesTerm *t) static void runes_parser_handle_ris(RunesTerm *t) { runes_display_use_normal_buffer(t); - runes_display_set_scroll_region(t, 1, t->rows, 1, t->cols); + runes_display_set_scroll_region(t, 0, t->rows - 1, 0, t->cols - 1); runes_display_clear_screen(t); runes_display_save_cursor(t); runes_display_reset_text_attributes(t); @@ -2891,7 +2891,7 @@ static void runes_parser_handle_csr(RunesTerm *t, char *buf, size_t len) runes_parser_extract_csi_params(buf + 2, len - 3, params, &nparams); runes_display_set_scroll_region( - t, params[0], params[1], params[2], params[3]); + t, params[0] - 1, params[1] - 1, params[2] - 1, params[3] - 1); } static void runes_parser_handle_decsed(RunesTerm *t, char *buf, size_t len) diff --git a/src/parser.l b/src/parser.l index 0fe5d06..8e49181 100644 --- a/src/parser.l +++ b/src/parser.l @@ -299,7 +299,7 @@ static void runes_parser_handle_ri(RunesTerm *t) static void runes_parser_handle_ris(RunesTerm *t) { runes_display_use_normal_buffer(t); - runes_display_set_scroll_region(t, 1, t->rows, 1, t->cols); + runes_display_set_scroll_region(t, 0, t->rows - 1, 0, t->cols - 1); runes_display_clear_screen(t); runes_display_save_cursor(t); runes_display_reset_text_attributes(t); @@ -761,7 +761,7 @@ static void runes_parser_handle_csr(RunesTerm *t, char *buf, size_t len) runes_parser_extract_csi_params(buf + 2, len - 3, params, &nparams); runes_display_set_scroll_region( - t, params[0], params[1], params[2], params[3]); + t, params[0] - 1, params[1] - 1, params[2] - 1, params[3] - 1); } static void runes_parser_handle_decsed(RunesTerm *t, char *buf, size_t len) |