diff src/gui_xim.c @ 28773:d770568e6c98 v8.2.4911

patch 8.2.4911: the mode #defines are not clearly named Commit: https://github.com/vim/vim/commit/249591057b4840785c50e41dd850efb8a8faf435 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 7 20:01:16 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 07 May 2022 21:15:06 +0200
parents 268f6a3511df
children 54247d52bee9
line wrap: on
line diff
--- a/src/gui_xim.c
+++ b/src/gui_xim.c
@@ -156,7 +156,7 @@ static int xim_has_preediting INIT(= FAL
     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 *e
     // 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 *e
 	    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;
 	    }