| ... | ... |
@@ -94,7 +94,7 @@ void clear(tty_t *tty){
|
| 94 | 94 |
while(line++ < NUMLINES + 1){
|
| 95 | 95 |
tty_newline(tty); |
| 96 | 96 |
} |
| 97 |
- fprintf(tty->fout, "%c%c%iA", 0x1b, '[', line-1); |
|
| 97 |
+ tty_moveup(tty, line-1); |
|
| 98 | 98 |
tty_setcol(tty, 0); |
| 99 | 99 |
} |
| 100 | 100 |
|
| ... | ... |
@@ -137,7 +137,7 @@ void draw(tty_t *tty){
|
| 137 | 137 |
draw_match(tty, choices[choices_sorted[i]], i == current_selection); |
| 138 | 138 |
line++; |
| 139 | 139 |
} |
| 140 |
- fprintf(tty->fout, "%c%c%iA", 0x1b, '[', line + 1); |
|
| 140 |
+ tty_moveup(tty, line + 1); |
|
| 141 | 141 |
tty_setcol(tty, strlen(prompt) + strlen(search) + 1); |
| 142 | 142 |
fflush(tty->fout); |
| 143 | 143 |
} |
| ... | ... |
@@ -67,6 +67,10 @@ void tty_setcol(tty_t *tty, int col){
|
| 67 | 67 |
tty_printf(tty, "%c%c%iG", 0x1b, '[', col); |
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 |
+void tty_moveup(tty_t *tty, int i){
|
|
| 71 |
+ tty_printf(tty, "%c%c%iA", 0x1b, '[', i); |
|
| 72 |
+} |
|
| 73 |
+ |
|
| 70 | 74 |
void tty_printf(tty_t *tty, const char *fmt, ...){
|
| 71 | 75 |
va_list args; |
| 72 | 76 |
va_start(args, fmt); |