aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-12 17:01:20 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-12 19:17:05 -0400
commit1f657eccc059b27d74e6792fdd5f8b66f0bd0fee (patch)
treee9dac7a815b952b39ca925c5a68454f9ea0fce9f
parent1180d57aba762b6f0892ea78f4ef46faaad33315 (diff)
downloadrunes-1f657eccc059b27d74e6792fdd5f8b66f0bd0fee.tar.gz
runes-1f657eccc059b27d74e6792fdd5f8b66f0bd0fee.zip
this abstraction isn't really necessary
-rw-r--r--display.c6
-rw-r--r--display.h1
-rw-r--r--vt100.c59
3 files changed, 15 insertions, 51 deletions
diff --git a/display.c b/display.c
index e06a564..94a0cfc 100644
--- a/display.c
+++ b/display.c
@@ -58,12 +58,6 @@ void runes_display_get_term_size(
*col = (int)(*xpixel / fontx);
}
-void runes_display_get_position(RunesTerm *t, int *row, int *col)
-{
- *row = t->row;
- *col = t->col;
-}
-
/* note: this uses the backend cairo context because it should be redrawn every
* time, and shouldn't be left behind when it moves */
void runes_display_draw_cursor(RunesTerm *t)
diff --git a/display.h b/display.h
index d5c8559..9fc535a 100644
--- a/display.h
+++ b/display.h
@@ -4,7 +4,6 @@
void runes_display_init(RunesTerm *t);
void runes_display_get_term_size(
RunesTerm *t, int *row, int *col, int *xpixel, int *ypixel);
-void runes_display_get_position(RunesTerm *t, int *row, int *col);
void runes_display_draw_cursor(RunesTerm *t);
void runes_display_move_to(RunesTerm *t, int row, int col);
void runes_display_show_string(RunesTerm *t, char *buf, size_t len);
diff --git a/vt100.c b/vt100.c
index 38430d5..43dafc8 100644
--- a/vt100.c
+++ b/vt100.c
@@ -63,41 +63,28 @@ static char *runes_vt100_handle_ctrl_char(RunesTerm *t, char *buf, size_t len)
runes_display_backspace(t);
buf++;
break;
- case '\011': { /* TAB */
- int row, col;
-
- runes_display_get_position(t, &row, &col);
- runes_display_move_to(t, row, col - (col % 8) + 8);
+ case '\011': /* TAB */
+ runes_display_move_to(t, t->row, t->col - (t->col % 8) + 8);
buf++;
break;
- }
case '\012': /* LF */
case '\013': /* VT */
- case '\014': { /* FF */
- int row, col;
-
- runes_display_get_position(t, &row, &col);
- runes_display_move_to(t, row + 1, col);
+ case '\014': /* FF */
+ runes_display_move_to(t, t->row + 1, t->col);
buf++;
break;
- }
- case '\015': { /* CR */
- int row, col;
-
- runes_display_get_position(t, &row, &col);
- runes_display_move_to(t, row, 0);
+ case '\015': /* CR */
+ runes_display_move_to(t, t->row, 0);
buf++;
break;
- }
case '\033':
buf++;
buf = runes_vt100_handle_escape_sequence(t, buf, len);
break;
- default: {
+ default:
buf++;
break;
}
- }
return buf;
}
@@ -151,34 +138,18 @@ static char *runes_vt100_handle_csi(RunesTerm *t, char *buf, size_t len)
}
switch (type) {
- case 'D': { /* CUB */
- int row, col;
-
- runes_display_get_position(t, &row, &col);
- runes_display_move_to(t, row, col - 1);
+ case 'D': /* CUB */
+ runes_display_move_to(t, t->row, t->col - 1);
break;
- }
- case 'B': { /* CUD */
- int row, col;
-
- runes_display_get_position(t, &row, &col);
- runes_display_move_to(t, row + 1, col);
+ case 'B': /* CUD */
+ runes_display_move_to(t, t->row + 1, t->col);
break;
- }
- case 'C': { /* CUF */
- int row, col;
-
- runes_display_get_position(t, &row, &col);
- runes_display_move_to(t, row, col + 1);
+ case 'C': /* CUF */
+ runes_display_move_to(t, t->row, t->col + 1);
break;
- }
- case 'A': { /* CUU */
- int row, col;
-
- runes_display_get_position(t, &row, &col);
- runes_display_move_to(t, row - 1, col);
+ case 'A': /* CUU */
+ runes_display_move_to(t, t->row - 1, t->col);
break;
- }
case 'H': /* CUP */
if (p[0] == -1) {
p[0] = 0;