summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-21 19:14:08 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-21 19:14:08 -0400
commitd9291474d73e1a5d482b9175cb0717dd2a9fd544 (patch)
tree322f9b6d053984d0edda44a8b5c3ce55018bf5cb
parent52b9226a73f9adc6aee64abf4a719c8622c43987 (diff)
downloadlibvt100-d9291474d73e1a5d482b9175cb0717dd2a9fd544.tar.gz
libvt100-d9291474d73e1a5d482b9175cb0717dd2a9fd544.zip
SU and SD were reversed from my scroll_up and scroll_down meanings
-rw-r--r--src/screen.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/screen.c b/src/screen.c
index 354c95a..24d9b94 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -273,13 +273,13 @@ void vt100_screen_move_to(VT100Screen *vt, int row, int col, int scroll)
if (row > bottom) {
if (scroll) {
- vt100_screen_scroll_down(vt, row - bottom);
+ vt100_screen_scroll_up(vt, row - bottom);
}
row = bottom;
}
else if (row < top) {
if (scroll) {
- vt100_screen_scroll_up(vt, top - row);
+ vt100_screen_scroll_down(vt, top - row);
}
row = top;
}
@@ -513,6 +513,39 @@ void vt100_screen_erase_characters(VT100Screen *vt, int count)
void vt100_screen_scroll_down(VT100Screen *vt, int count)
{
struct vt100_row *row;
+ int bottom = vt->grid->scroll_bottom, top = vt->grid->scroll_top;
+ int i;
+
+ if (bottom - top + 1 > count) {
+ for (i = 0; i < count; ++i) {
+ row = vt100_screen_row_at(vt, bottom - i);
+ free(row->cells);
+ }
+ row = vt100_screen_row_at(vt, top);
+ memmove(
+ row + count, row,
+ (bottom - top + 1 - count) * sizeof(struct vt100_row));
+ for (i = 0; i < count; ++i) {
+ row = vt100_screen_row_at(vt, top + i);
+ row->cells = calloc(vt->grid->max.col, sizeof(struct vt100_cell));
+ row->wrapped = 0;
+ }
+ }
+ else {
+ for (i = 0; i < bottom - top + 1; ++i) {
+ row = vt100_screen_row_at(vt, top + i);
+ memset(
+ row->cells, 0, vt->grid->max.col * sizeof(struct vt100_cell));
+ row->wrapped = 0;
+ }
+ }
+
+ vt->dirty = 1;
+}
+
+void vt100_screen_scroll_up(VT100Screen *vt, int count)
+{
+ struct vt100_row *row;
int i;
if (vt100_screen_scroll_region_is_active(vt) || vt->alternate) {
@@ -579,39 +612,6 @@ void vt100_screen_scroll_down(VT100Screen *vt, int count)
vt->dirty = 1;
}
-void vt100_screen_scroll_up(VT100Screen *vt, int count)
-{
- struct vt100_row *row;
- int bottom = vt->grid->scroll_bottom, top = vt->grid->scroll_top;
- int i;
-
- if (bottom - top + 1 > count) {
- for (i = 0; i < count; ++i) {
- row = vt100_screen_row_at(vt, bottom - i);
- free(row->cells);
- }
- row = vt100_screen_row_at(vt, top);
- memmove(
- row + count, row,
- (bottom - top + 1 - count) * sizeof(struct vt100_row));
- for (i = 0; i < count; ++i) {
- row = vt100_screen_row_at(vt, top + i);
- row->cells = calloc(vt->grid->max.col, sizeof(struct vt100_cell));
- row->wrapped = 0;
- }
- }
- else {
- for (i = 0; i < bottom - top + 1; ++i) {
- row = vt100_screen_row_at(vt, top + i);
- memset(
- row->cells, 0, vt->grid->max.col * sizeof(struct vt100_cell));
- row->wrapped = 0;
- }
- }
-
- vt->dirty = 1;
-}
-
void vt100_screen_set_scroll_region(
VT100Screen *vt, int top, int bottom, int left, int right)
{