History

Cleanup

cancel committed 6 years ago

Commit f35e1871 parent 83dfdd51 file · +10 −17Browse files

Unified · Split

tui_main.c+10−17
@@ -3482,26 +3482,19 @@ int main(int argc, char **argv) { · 3481 unmodified lines
34823482
34833483 tui_adjust_term_size(&t, &cont_window);
34843484
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.
34943487 if (should_autosize_grid) {
34953488 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;
35043493 }
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);
35053498 }
35063499 // Send initial BPM
35073500 send_num_message(t.ged.oosc_dev, "/orca/bpm", (I32)t.ged.bpm);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t