Fix --show-info when lines do not fit in the screen
| ... | ... |
@@ -53,8 +53,12 @@ int main(int argc, char *argv[]) {
|
| 53 | 53 |
if (options.num_lines > choices.size) |
| 54 | 54 |
options.num_lines = choices.size; |
| 55 | 55 |
|
| 56 |
- if (options.num_lines + 1 > tty_getheight(&tty)) |
|
| 57 |
- options.num_lines = tty_getheight(&tty) - 1; |
|
| 56 |
+ int num_lines_adjustment = 1; |
|
| 57 |
+ if (options.show_info) |
|
| 58 |
+ num_lines_adjustment++; |
|
| 59 |
+ |
|
| 60 |
+ if (options.num_lines + num_lines_adjustment > tty_getheight(&tty)) |
|
| 61 |
+ options.num_lines = tty_getheight(&tty) - num_lines_adjustment; |
|
| 58 | 62 |
|
| 59 | 63 |
tty_interface_t tty_interface; |
| 60 | 64 |
tty_interface_init(&tty_interface, &tty, &choices, &options); |