| ... | ... |
@@ -125,24 +125,22 @@ void draw_match(tty_t *tty, const char *choice, int selected){
|
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
void draw(tty_t *tty){
|
| 128 |
- int start = 0; |
|
| 128 |
+ size_t start = 0; |
|
| 129 | 129 |
if(current_selection >= NUMLINES){
|
| 130 | 130 |
start = current_selection - NUMLINES + 1; |
| 131 | 131 |
} |
| 132 |
- int line = 0; |
|
| 133 | 132 |
const char *prompt = "> "; |
| 134 | 133 |
tty_setcol(tty, 0); |
| 135 | 134 |
tty_printf(tty, "%s%s", prompt, search); |
| 136 | 135 |
tty_newline(tty); |
| 137 |
- for(size_t i = start; line < NUMLINES; i++){
|
|
| 136 |
+ for(size_t i = start; i < start + NUMLINES; i++){
|
|
| 138 | 137 |
if(i < choices_available){
|
| 139 | 138 |
draw_match(tty, choices[choices_sorted[i]], i == current_selection); |
| 140 | 139 |
}else{
|
| 141 | 140 |
tty_newline(tty); |
| 142 | 141 |
} |
| 143 |
- line++; |
|
| 144 | 142 |
} |
| 145 |
- tty_moveup(tty, line + 1); |
|
| 143 |
+ tty_moveup(tty, NUMLINES + 1); |
|
| 146 | 144 |
tty_setcol(tty, strlen(prompt) + strlen(search)); |
| 147 | 145 |
tty_flush(tty); |
| 148 | 146 |
} |