Skip to content

Commit

Permalink
Fix: Window location code
Browse files Browse the repository at this point in the history
This bug happens when additional plot stacks get allocated when there is enough
room in the terminal.
An integer division rounding leads to some location to be skipped.
  • Loading branch information
Syllo committed Sep 22, 2019
1 parent c049a08 commit 8b56210
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/interface_layout_selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ void compute_sizes_from_layout(
if (*num_plots == 0) {
*plot_positions = NULL;
} else {
*plot_positions = malloc(*num_plots * sizeof(**plot_positions));
*plot_positions = calloc(*num_plots, sizeof(**plot_positions));
*plot_types = preferred_plot_type;
unsigned rows_per_stack = rows_left / num_plot_stacks;
if (rows_per_stack > 23)
rows_per_stack = 23;
unsigned plot_per_row = *num_plots / num_plot_stacks;
unsigned plot_per_row = (*num_plots + (*num_plots % num_plot_stacks)) / num_plot_stacks;
unsigned num_plot_done = 0;
unsigned currentPosX = 0, currentPosY = rows_for_header;
for (unsigned i = 0; i < num_plot_stacks; ++i) {
Expand Down

0 comments on commit 8b56210

Please sign in to comment.