diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-08-15 19:47:02 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-08-15 19:50:13 +0200 |
commit | 810969053073b01c948f6566cc1a5b013de3fa32 (patch) | |
tree | 4ed81bae6ea7459ec5fcef78e385bc9729398cb1 /src | |
parent | 6261d2658fdff93a732b02d8fd6e386245968f2d (diff) | |
download | rneovim-810969053073b01c948f6566cc1a5b013de3fa32.tar.gz rneovim-810969053073b01c948f6566cc1a5b013de3fa32.tar.bz2 rneovim-810969053073b01c948f6566cc1a5b013de3fa32.zip |
TUI: do not use "starting" global mutated by main thread
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/tui/tui.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 519ef1cccd..267a06d318 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -103,6 +103,7 @@ typedef struct { bool busy, is_invisible; bool cork, overflow; bool cursor_color_changed; + bool is_starting; cursorentry_T cursor_shapes[SHAPE_IDX_COUNT]; HlAttrs clear_attrs; kvec_t(HlAttrs) attrs; @@ -396,6 +397,7 @@ static void tui_main(UIBridgeData *bridge, UI *ui) ui->data = data; data->bridge = bridge; data->loop = &tui_loop; + data->is_starting = true; kv_init(data->invalid_regions); signal_watcher_init(data->loop, &data->winch_handle, ui); signal_watcher_init(data->loop, &data->cont_handle, data); @@ -888,7 +890,7 @@ static void tui_grid_resize(UI *ui, Integer g, Integer width, Integer height) r->right = MIN(r->right, grid->width); } - if (!got_winch && (!starting || did_user_set_dimensions)) { + if (!got_winch && (!data->is_starting || did_user_set_dimensions)) { // Resize the _host_ terminal. UNIBI_SET_NUM_VAR(data->params[0], (int)height); UNIBI_SET_NUM_VAR(data->params[1], (int)width); @@ -1051,6 +1053,7 @@ static void tui_mode_change(UI *ui, String mode, Integer mode_idx) { TUIData *data = ui->data; tui_set_mode(ui, (ModeShape)mode_idx); + data->is_starting = false; // mode entered, no longer starting data->showing_mode = (ModeShape)mode_idx; } @@ -1355,7 +1358,7 @@ static void tui_guess_size(UI *ui) int width = 0, height = 0; // 1 - look for non-default 'columns' and 'lines' options during startup - if (starting && (Columns != DFLT_COLS || Rows != DFLT_ROWS)) { + if (data->is_starting && (Columns != DFLT_COLS || Rows != DFLT_ROWS)) { did_user_set_dimensions = true; assert(Columns >= INT_MIN && Columns <= INT_MAX); assert(Rows >= INT_MIN && Rows <= INT_MAX); |