diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/edit.c | 4 | ||||
-rw-r--r-- | src/nvim/eval.c | 6 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 38 | ||||
-rw-r--r-- | src/nvim/popupmnu.c | 4 | ||||
-rw-r--r-- | src/nvim/screen.c | 16 | ||||
-rw-r--r-- | src/nvim/syntax.c | 2 | ||||
-rw-r--r-- | src/nvim/ui.c | 6 | ||||
-rw-r--r-- | src/nvim/window.c | 10 |
8 files changed, 40 insertions, 46 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index a63dd97ba8..62b35fa708 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2495,10 +2495,6 @@ static int compl_match_arraysize; /* - * Update the screen and when there is any scrolling remove the popup menu. - */ - -/* * Remove any popup menu. */ static void ins_compl_del_pum(void) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 3980516d32..df02a5ba17 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -11265,7 +11265,7 @@ void get_user_input(const typval_T *const argvars, // Only the part of the message after the last NL is considered as // prompt for the command line, unlsess cmdline is externalized const char *p = prompt; - if (!ui_is_external(kUICmdline)) { + if (!ui_has(kUICmdline)) { const char *lastnl = strrchr(prompt, '\n'); if (lastnl != NULL) { p = lastnl+1; @@ -19951,7 +19951,7 @@ void ex_function(exarg_T *eap) goto errret_2; } - if (KeyTyped && ui_is_external(kUICmdline)) { + if (KeyTyped && ui_has(kUICmdline)) { show_block = true; ui_ext_cmdline_block_append(0, (const char *)eap->cmd); } @@ -20007,7 +20007,7 @@ void ex_function(exarg_T *eap) if (!eap->skip && did_emsg) goto erret; - if (!ui_is_external(kUICmdline)) { + if (!ui_has(kUICmdline)) { msg_putchar('\n'); // don't overwrite the function name } cmdline_row = msg_row; diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index bd03160bcd..e8375cd3cc 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -494,7 +494,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent) char_u *p = ccline.cmdbuff; - if (ui_is_external(kUICmdline)) { + if (ui_has(kUICmdline)) { ui_call_cmdline_hide(ccline.level); } @@ -614,7 +614,7 @@ static int command_line_execute(VimState *state, int key) if (!(s->c == p_wc && KeyTyped) && s->c != p_wcm && s->c != Ctrl_N && s->c != Ctrl_P && s->c != Ctrl_A && s->c != Ctrl_L) { - if (ui_is_external(kUIWildmenu)) { + if (ui_has(kUIWildmenu)) { ui_call_wildmenu_hide(); } if (s->xpc.xp_numfiles != -1) { @@ -896,7 +896,7 @@ static int command_line_execute(VimState *state, int key) } if (!cmd_silent) { - if (!ui_is_external(kUICmdline)) { + if (!ui_has(kUICmdline)) { ui_cursor_goto(msg_row, 0); } ui_flush(); @@ -1254,7 +1254,7 @@ static int command_line_handle_key(CommandLineState *s) xfree(ccline.cmdbuff); // no commandline to return ccline.cmdbuff = NULL; - if (!cmd_silent && !ui_is_external(kUICmdline)) { + if (!cmd_silent && !ui_has(kUICmdline)) { if (cmdmsg_rl) { msg_col = Columns; } else { @@ -1704,7 +1704,7 @@ static int command_line_handle_key(CommandLineState *s) s->do_abbr = false; // don't do abbreviation now // may need to remove ^ when composing char was typed if (enc_utf8 && utf_iscomposing(s->c) && !cmd_silent) { - if (ui_is_external(kUICmdline)) { + if (ui_has(kUICmdline)) { // TODO(bfredl): why not make unputcmdline also work with true? unputcmdline(); } else { @@ -1968,7 +1968,7 @@ static int command_line_changed(CommandLineState *s) // Do it only when there are no characters left to read // to avoid useless intermediate redraws. // if cmdline is external the ui handles shaping, no redraw needed. - if (!ui_is_external(kUICmdline) && vpeekc() == NUL) { + if (!ui_has(kUICmdline) && vpeekc() == NUL) { redrawcmd(); } } @@ -2835,7 +2835,7 @@ static void draw_cmdline(int start, int len) return; } - if (ui_is_external(kUICmdline)) { + if (ui_has(kUICmdline)) { ccline.special_char = NUL; ccline.redraw_state = kCmdRedrawAll; return; @@ -3028,7 +3028,7 @@ void ui_ext_cmdline_block_leave(void) /// assumes "redrawcmdline()" will already be invoked void cmdline_screen_cleared(void) { - if (!ui_is_external(kUICmdline)) { + if (!ui_has(kUICmdline)) { return; } @@ -3053,7 +3053,7 @@ void cmdline_screen_cleared(void) /// called by ui_flush, do what redraws neccessary to keep cmdline updated. void cmdline_ui_flush(void) { - if (!ui_is_external(kUICmdline)) { + if (!ui_has(kUICmdline)) { return; } int level = ccline.level; @@ -3082,7 +3082,7 @@ void putcmdline(int c, int shift) if (cmd_silent) { return; } - if (!ui_is_external(kUICmdline)) { + if (!ui_has(kUICmdline)) { msg_no_more = true; msg_putchar(c); if (shift) { @@ -3108,7 +3108,7 @@ void unputcmdline(void) return; } msg_no_more = true; - if (ccline.cmdlen == ccline.cmdpos && !ui_is_external(kUICmdline)) { + if (ccline.cmdlen == ccline.cmdpos && !ui_has(kUICmdline)) { msg_putchar(' '); } else { draw_cmdline(ccline.cmdpos, mb_ptr2len(ccline.cmdbuff + ccline.cmdpos)); @@ -3423,7 +3423,7 @@ static void redrawcmdprompt(void) if (cmd_silent) return; - if (ui_is_external(kUICmdline)) { + if (ui_has(kUICmdline)) { ccline.redraw_state = kCmdRedrawAll; return; } @@ -3452,7 +3452,7 @@ void redrawcmd(void) if (cmd_silent) return; - if (ui_is_external(kUICmdline)) { + if (ui_has(kUICmdline)) { draw_cmdline(0, ccline.cmdlen); return; } @@ -3500,7 +3500,7 @@ static void cursorcmd(void) if (cmd_silent) return; - if (ui_is_external(kUICmdline)) { + if (ui_has(kUICmdline)) { if (ccline.redraw_state < kCmdRedrawPos) { ccline.redraw_state = kCmdRedrawPos; } @@ -3525,7 +3525,7 @@ static void cursorcmd(void) void gotocmdline(int clr) { - if (ui_is_external(kUICmdline)) { + if (ui_has(kUICmdline)) { return; } msg_start(); @@ -3613,7 +3613,7 @@ nextwild ( return FAIL; } - if (!ui_is_external(kUIWildmenu)) { + if (!ui_has(kUIWildmenu)) { MSG_PUTS("..."); // show that we are busy ui_flush(); } @@ -3763,7 +3763,7 @@ ExpandOne ( findex = -1; } if (p_wmnu) { - if (ui_is_external(kUIWildmenu)) { + if (ui_has(kUIWildmenu)) { ui_call_wildmenu_select(findex); } else { win_redr_status_matches(xp, xp->xp_numfiles, xp->xp_files, @@ -4118,7 +4118,7 @@ static int showmatches(expand_T *xp, int wildmenu) showtail = cmd_showtail; } - if (ui_is_external(kUIWildmenu)) { + if (ui_has(kUIWildmenu)) { Array args = ARRAY_DICT_INIT; for (i = 0; i < num_files; i++) { ADD(args, STRING_OBJ(cstr_to_string((char *)files_found[i]))); @@ -6124,7 +6124,7 @@ static int open_cmdwin(void) curwin->w_cursor.col = ccline.cmdpos; changed_line_abv_curs(); invalidate_botline(); - if (ui_is_external(kUICmdline)) { + if (ui_has(kUICmdline)) { ccline.redraw_state = kCmdRedrawNone; ui_call_cmdline_hide(ccline.level); } diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index d64406846a..40f62b437c 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -82,7 +82,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed) if (!pum_is_visible) { // To keep the code simple, we only allow changing the // draw mode when the popup menu is not being displayed - pum_external = ui_is_external(kUIPopupmenu); + pum_external = ui_has(kUIPopupmenu); } do { @@ -103,7 +103,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed) } int grid = (int)curwin->w_grid.handle; - if (!ui_is_external(kUIMultigrid)) { + if (!ui_has(kUIMultigrid)) { grid = (int)default_grid.handle; row += curwin->w_winrow; col += curwin->w_wincol; diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 759eefaecc..014f63f400 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -4209,7 +4209,7 @@ win_line ( && lcs_eol_one != -1 // Haven't printed the lcs_eol character. && row != endrow - 1 // Not the last line being displayed. && (grid->Columns == Columns // Window spans the width of the screen, - || ui_is_external(kUIMultigrid)) // or has dedicated grid. + || ui_has(kUIMultigrid)) // or has dedicated grid. && !wp->w_p_rl; // Not right-to-left. grid_put_linebuf(grid, row, 0, col - boguscols, grid->Columns, wp->w_p_rl, wp, wp->w_hl_attr_normal, wrap); @@ -4816,8 +4816,6 @@ win_redr_status_matches ( /// Redraw the status line of window `wp`. /// /// If inversion is possible we use it. Else '=' characters are used. -/// If "ignore_pum" is true, also redraw statusline when the popup menu is -/// displayed. static void win_redr_status(win_T *wp) { int row; @@ -4832,7 +4830,7 @@ static void win_redr_status(win_T *wp) // invokes ":redrawstatus". Simply ignore the call then. if (busy // Also ignore if wildmenu is showing. - || (wild_menu_showing != 0 && !ui_is_external(kUIWildmenu))) { + || (wild_menu_showing != 0 && !ui_has(kUIWildmenu))) { return; } busy = true; @@ -5929,7 +5927,7 @@ void win_grid_alloc(win_T *wp) int cols = wp->w_width_inner; // TODO(bfredl): floating windows should force this to true - bool want_allocation = ui_is_external(kUIMultigrid); + bool want_allocation = ui_has(kUIMultigrid); bool has_allocation = (grid->chars != NULL); if (want_allocation && has_allocation && highlights_invalid) { @@ -5965,7 +5963,7 @@ void win_grid_alloc(win_T *wp) // - a grid was just resized // - screen_resize was called and all grid sizes must be sent // - the UI wants multigrid event (necessary) - if ((send_grid_resize || was_resized) && ui_is_external(kUIMultigrid)) { + if ((send_grid_resize || was_resized) && ui_has(kUIMultigrid)) { ui_call_grid_resize(grid->handle, grid->Columns, grid->Rows); } } @@ -6025,8 +6023,8 @@ retry: */ ++RedrawingDisabled; - // win_new_shellsize will recompute floats posititon, but tell the - // compositor to now redraw them yet + // win_new_shellsize will recompute floats position, but tell the + // compositor to not redraw them yet ui_comp_invalidate_screen(); win_new_shellsize(); /* fit the windows in the new sized shell */ @@ -6672,7 +6670,7 @@ static void draw_tabline(void) } redraw_tabline = false; - if (ui_is_external(kUITabline)) { + if (ui_has(kUITabline)) { ui_ext_tabline_update(); return; } diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 81c78ca6a9..b6b7dfff11 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -6893,7 +6893,7 @@ void do_highlight(const char *line, const bool forceit, const bool init) // "fg", which have been changed now. highlight_attr_set_all(); - if (!ui_is_external(kUILinegrid) && starting == 0) { + if (!ui_has(kUILinegrid) && starting == 0) { // Older UIs assume that we clear the screen after normal group is // changed ui_refresh(); diff --git a/src/nvim/ui.c b/src/nvim/ui.c index dd4eb0f196..6a7cbd36cc 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -413,10 +413,10 @@ void ui_cursor_shape(void) conceal_check_cursor_line(); } -/// Returns true if `widget` is externalized. -bool ui_is_external(UIExtension widget) +/// Returns true if the given UI extension is enabled. +bool ui_has(UIExtension ext) { - return ui_ext[widget]; + return ui_ext[ext]; } Array ui_array(void) diff --git a/src/nvim/window.c b/src/nvim/window.c index 91a983e4c7..e8b067d46c 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -3120,7 +3120,7 @@ int win_new_tabpage(int after, char_u *filename) redraw_all_later(NOT_VALID); - if (ui_is_external(kUIMultigrid)) { + if (ui_has(kUIMultigrid)) { tabpage_check_windows(tp); } @@ -3321,7 +3321,7 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_au lastwin = tp->tp_lastwin; topframe = tp->tp_topframe; - if (old_curtab != curtab && ui_is_external(kUIMultigrid)) { + if (old_curtab != curtab && ui_has(kUIMultigrid)) { tabpage_check_windows(old_curtab); } @@ -4011,7 +4011,7 @@ win_free ( void win_free_grid(win_T *wp, bool reinit) { - if (wp->w_grid.handle != 0 && ui_is_external(kUIMultigrid)) { + if (wp->w_grid.handle != 0 && ui_has(kUIMultigrid)) { ui_call_grid_destroy(wp->w_grid.handle); wp->w_grid.handle = 0; } @@ -5349,7 +5349,7 @@ static void last_status_rec(frame_T *fr, int statusline) */ int tabline_height(void) { - if (ui_is_external(kUITabline)) { + if (ui_has(kUITabline)) { return 0; } assert(first_tabpage); @@ -6086,7 +6086,7 @@ void win_findbuf(typval_T *argvars, list_T *list) void win_ui_flush(void) { - if (!ui_is_external(kUIMultigrid)) { + if (!ui_has(kUIMultigrid)) { return; } |