Skip to content

Commit

Permalink
Fix --show-info when lines do not fit in the screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Mārtiņš Mačs committed Jan 29, 2020
1 parent 28195b3 commit b2d5381
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/fzy.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ int main(int argc, char *argv[]) {
if (options.num_lines > choices.size)
options.num_lines = choices.size;

if (options.num_lines + 1 > tty_getheight(&tty))
options.num_lines = tty_getheight(&tty) - 1;
int num_lines_adjustment = 1;
if (options.show_info)
num_lines_adjustment++;

if (options.num_lines + num_lines_adjustment > tty_getheight(&tty))
options.num_lines = tty_getheight(&tty) - num_lines_adjustment;

tty_interface_t tty_interface;
tty_interface_init(&tty_interface, &tty, &choices, &options);
Expand Down

0 comments on commit b2d5381

Please sign in to comment.