Unified · Split
| @@ -3482,26 +3482,19 @@ int main(int argc, char **argv) { · 3481 unmodified lines | ||
| 3482 | 3482 | |
| 3483 | 3483 | tui_adjust_term_size(&t, &cont_window); |
| 3484 | 3484 | |
| 3485 | − // If this is true, then we haven't yet initialized the main field, because | |
| 3486 | − // we didn't load a file from disk or have an explicit size set as a | |
| 3487 | − // commandline option. So, we waited until we were able to initialize the | |
| 3488 | − // curses stuff so that we could get an accurate terminal size, and then | |
| 3489 | − // calculate and create the curses windows and stuff. This was done in | |
| 3490 | − // tui_adjust_term_size(). Now that it's done, we can ask for a good size for | |
| 3491 | − // the initial grid for this new file, and then initialize the field with it. | |
| 3492 | − // (This saves us picking some arbitrary size to start with, then having to | |
| 3493 | − // reallocate/re-memset it.) | |
| 3485 | + // If we haven't yet initialized the grid, because we were waiting for the | |
| 3486 | + // terminal size, do it now. | |
| 3494 | 3487 | if (should_autosize_grid) { |
| 3495 | 3488 | Usz new_field_h, new_field_w; |
| 3496 | − if (tui_suggest_nice_grid_size(&t, t.ged.win_h, t.ged.win_w, &new_field_h, | |
| 3497 | − &new_field_w)) { | |
| 3498 | − field_init_fill(&t.ged.field, (Usz)new_field_h, (Usz)new_field_w, '.'); | |
| 3499 | − mbuf_reusable_ensure_size(&t.ged.mbuf_r, new_field_h, new_field_w); | |
| 3500 | − ged_make_cursor_visible(&t.ged); | |
| 3501 | − } else { | |
| 3502 | − field_init_fill(&t.ged.field, (Usz)init_grid_dim_y, (Usz)init_grid_dim_x, | |
| 3503 | − '.'); | |
| 3489 | + if (!tui_suggest_nice_grid_size(&t, t.ged.win_h, t.ged.win_w, &new_field_h, | |
| 3490 | + &new_field_w)) { | |
| 3491 | + new_field_h = (Usz)init_grid_dim_y; | |
| 3492 | + new_field_w = (Usz)init_grid_dim_x; | |
| 3504 | 3493 | } |
| 3494 | + field_init_fill(&t.ged.field, (Usz)new_field_h, (Usz)new_field_w, '.'); | |
| 3495 | + mbuf_reusable_ensure_size(&t.ged.mbuf_r, t.ged.field.height, | |
| 3496 | + t.ged.field.width); | |
| 3497 | + ged_make_cursor_visible(&t.ged); | |
| 3505 | 3498 | } |
| 3506 | 3499 | // Send initial BPM |
| 3507 | 3500 | send_num_message(t.ged.oosc_dev, "/orca/bpm", (I32)t.ged.bpm); |