From 249591057b4840785c50e41dd850efb8a8faf435 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 7 May 2022 20:01:16 +0100 Subject: patch 8.2.4911: the mode #defines are not clearly named Problem: The mode #defines are not clearly named. Solution: Prepend MODE_. Renumber them to put the mapped modes first. --- src/gui_xim.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/gui_xim.c') diff --git a/src/gui_xim.c b/src/gui_xim.c index 1dfb1056da..9f3181e769 100644 --- a/src/gui_xim.c +++ b/src/gui_xim.c @@ -156,7 +156,7 @@ static int xim_has_preediting INIT(= FALSE); // IM current status static void init_preedit_start_col(void) { - if (State & CMDLINE) + if (State & MODE_CMDLINE) preedit_start_col = cmdline_getvcol_cursor(); else if (curwin != NULL && curwin->w_buffer != NULL) getvcol(curwin, &curwin->w_cursor, &preedit_start_col, NULL, NULL); @@ -420,7 +420,7 @@ im_delete_preedit(void) return; } - if (State & NORMAL + if (State & MODE_NORMAL #ifdef FEAT_TERMINAL && !term_use_loop() #endif @@ -446,10 +446,10 @@ im_correct_cursor(int num_move_back) { char_u backkey[] = {CSI, 'k', 'l'}; - if (State & NORMAL) + if (State & MODE_NORMAL) return; # ifdef FEAT_RIGHTLEFT - if ((State & CMDLINE) == 0 && curwin != NULL && curwin->w_p_rl) + if ((State & MODE_CMDLINE) == 0 && curwin != NULL && curwin->w_p_rl) backkey[2] = 'r'; # endif for (; num_move_back > 0; --num_move_back) @@ -471,7 +471,7 @@ im_show_info(void) vgetc_busy = TRUE; showmode(); vgetc_busy = old_vgetc_busy; - if ((State & NORMAL) || (State & INSERT)) + if ((State & MODE_NORMAL) || (State & MODE_INSERT)) setcursor(); out_flush(); } @@ -1078,7 +1078,8 @@ xim_queue_key_press_event(GdkEventKey *event, int down) // gtk_im_context_filter_keypress() in Normal mode. // And while doing :sh too. if (xic != NULL && !p_imdisable - && (State & (INSERT | CMDLINE | NORMAL | EXTERNCMD)) != 0) + && (State & (MODE_INSERT | MODE_CMDLINE + | MODE_NORMAL | MODE_EXTERNCMD))) { // Filter 'imactivatekey' and map it to CTRL-^. This way, Vim is // always aware of the current status of IM, and can even emulate @@ -1102,21 +1103,21 @@ xim_queue_key_press_event(GdkEventKey *event, int down) if (event->type != GDK_KEY_PRESS) return TRUE; - if (map_to_exists_mode((char_u *)"", LANGMAP, FALSE)) + if (map_to_exists_mode((char_u *)"", MODE_LANGMAP, FALSE)) { im_set_active(FALSE); // ":lmap" mappings exists, toggle use of mappings. - State ^= LANGMAP; - if (State & LANGMAP) + State ^= MODE_LANGMAP; + if (State & MODE_LANGMAP) { curbuf->b_p_iminsert = B_IMODE_NONE; - State &= ~LANGMAP; + State &= ~MODE_LANGMAP; } else { curbuf->b_p_iminsert = B_IMODE_LMAP; - State |= LANGMAP; + State |= MODE_LANGMAP; } return TRUE; } -- cgit v1.2.3