diff src/term.c @ 18814:7e7ec935e7c8 v8.1.2395

patch 8.1.2395: using old C style comments Commit: https://github.com/vim/vim/commit/0d6f5d9740dbad1b0207f3ab257de806169dd905 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 5 21:33:15 2019 +0100 patch 8.1.2395: using old C style comments Problem: Using old C style comments. Solution: Use // comments where appropriate.
author Bram Moolenaar <Bram@vim.org>
date Thu, 05 Dec 2019 21:45:04 +0100
parents 14d2a210fab1
children 8dabdfc7c799
line wrap: on
line diff
--- a/src/term.c
+++ b/src/term.c
@@ -27,7 +27,7 @@
 
 #ifdef HAVE_TGETENT
 # ifdef HAVE_TERMIOS_H
-#  include <termios.h>	    /* seems to be required for some Linux */
+#  include <termios.h>	    // seems to be required for some Linux
 # endif
 # ifdef HAVE_TERMCAP_H
 #  include <termcap.h>
@@ -71,7 +71,7 @@ struct builtin_term
     char	*bt_string;
 };
 
-/* start of keys that are not directly used by Vim but can be mapped */
+// start of keys that are not directly used by Vim but can be mapped
 #define BT_EXTRA_KEYS	0x101
 
 static void parse_builtin_tcap(char_u *s);
@@ -97,7 +97,7 @@ static char *tgetent_error(char_u *, cha
 char		*tgetstr(char *, char **);
 
 # ifdef FEAT_TERMRESPONSE
-    /* Change this to "if 1" to debug what happens with termresponse. */
+    // Change this to "if 1" to debug what happens with termresponse.
 #  if 0
 #   define DEBUG_TERMRESPONSE
 static void log_tr(const char *fmt, ...);
@@ -137,16 +137,16 @@ static int bg_g = 255;
 static int bg_b = 255;
 #  endif
 
-/* Request background color report: */
+// Request background color report:
 static termrequest_T rbg_status = TERMREQUEST_INIT;
 
-/* Request cursor blinking mode report: */
+// Request cursor blinking mode report:
 static termrequest_T rbm_status = TERMREQUEST_INIT;
 
-/* Request cursor style report: */
+// Request cursor style report:
 static termrequest_T rcs_status = TERMREQUEST_INIT;
 
-/* Request windos position report: */
+// Request windos position report:
 static termrequest_T winpos_status = TERMREQUEST_INIT;
 
 static termrequest_T *all_termrequests[] = {
@@ -188,20 +188,20 @@ char *UP, *BC, PC;
 # define TGETSTR(s, p)	vim_tgetstr((s), (p))
 # define TGETENT(b, t)	tgetent((char *)(b), (char *)(t))
 static char_u *vim_tgetstr(char *s, char_u **pp);
-#endif /* HAVE_TGETENT */
-
-static int  detected_8bit = FALSE;	/* detected 8-bit terminal */
+#endif // HAVE_TGETENT
+
+static int  detected_8bit = FALSE;	// detected 8-bit terminal
 
 #ifdef FEAT_TERMRESPONSE
-/* When the cursor shape was detected these values are used:
- * 1: block, 2: underline, 3: vertical bar */
+// When the cursor shape was detected these values are used:
+// 1: block, 2: underline, 3: vertical bar
 static int initial_cursor_shape = 0;
 
-/* The blink flag from the style response may be inverted from the actual
- * blinking state, xterm XORs the flags. */
+// The blink flag from the style response may be inverted from the actual
+// blinking state, xterm XORs the flags.
 static int initial_cursor_shape_blink = FALSE;
 
-/* The blink flag from the blinking-cursor mode response */
+// The blink flag from the blinking-cursor mode response
 static int initial_cursor_blink = FALSE;
 #endif
 
@@ -231,33 +231,33 @@ static struct builtin_term builtin_termc
     {(int)KS_CSV,	IF_EB("\033|%d;%dV", ESC_STR "|%d;%dV")},
 # endif
     {(int)KS_CL,	IF_EB("\033|C", ESC_STR "|C")},
-			/* attributes switched on with 'h', off with * 'H' */
-    {(int)KS_ME,	IF_EB("\033|31H", ESC_STR "|31H")}, /* HL_ALL */
-    {(int)KS_MR,	IF_EB("\033|1h", ESC_STR "|1h")},   /* HL_INVERSE */
-    {(int)KS_MD,	IF_EB("\033|2h", ESC_STR "|2h")},   /* HL_BOLD */
-    {(int)KS_SE,	IF_EB("\033|16H", ESC_STR "|16H")}, /* HL_STANDOUT */
-    {(int)KS_SO,	IF_EB("\033|16h", ESC_STR "|16h")}, /* HL_STANDOUT */
-    {(int)KS_UE,	IF_EB("\033|8H", ESC_STR "|8H")},   /* HL_UNDERLINE */
-    {(int)KS_US,	IF_EB("\033|8h", ESC_STR "|8h")},   /* HL_UNDERLINE */
-    {(int)KS_UCE,	IF_EB("\033|8C", ESC_STR "|8C")},   /* HL_UNDERCURL */
-    {(int)KS_UCS,	IF_EB("\033|8c", ESC_STR "|8c")},   /* HL_UNDERCURL */
-    {(int)KS_STE,	IF_EB("\033|4C", ESC_STR "|4C")},   /* HL_STRIKETHROUGH */
-    {(int)KS_STS,	IF_EB("\033|4c", ESC_STR "|4c")},   /* HL_STRIKETHROUGH */
-    {(int)KS_CZR,	IF_EB("\033|4H", ESC_STR "|4H")},   /* HL_ITALIC */
-    {(int)KS_CZH,	IF_EB("\033|4h", ESC_STR "|4h")},   /* HL_ITALIC */
+			// attributes switched on with 'h', off with * 'H'
+    {(int)KS_ME,	IF_EB("\033|31H", ESC_STR "|31H")}, // HL_ALL
+    {(int)KS_MR,	IF_EB("\033|1h", ESC_STR "|1h")},   // HL_INVERSE
+    {(int)KS_MD,	IF_EB("\033|2h", ESC_STR "|2h")},   // HL_BOLD
+    {(int)KS_SE,	IF_EB("\033|16H", ESC_STR "|16H")}, // HL_STANDOUT
+    {(int)KS_SO,	IF_EB("\033|16h", ESC_STR "|16h")}, // HL_STANDOUT
+    {(int)KS_UE,	IF_EB("\033|8H", ESC_STR "|8H")},   // HL_UNDERLINE
+    {(int)KS_US,	IF_EB("\033|8h", ESC_STR "|8h")},   // HL_UNDERLINE
+    {(int)KS_UCE,	IF_EB("\033|8C", ESC_STR "|8C")},   // HL_UNDERCURL
+    {(int)KS_UCS,	IF_EB("\033|8c", ESC_STR "|8c")},   // HL_UNDERCURL
+    {(int)KS_STE,	IF_EB("\033|4C", ESC_STR "|4C")},   // HL_STRIKETHROUGH
+    {(int)KS_STS,	IF_EB("\033|4c", ESC_STR "|4c")},   // HL_STRIKETHROUGH
+    {(int)KS_CZR,	IF_EB("\033|4H", ESC_STR "|4H")},   // HL_ITALIC
+    {(int)KS_CZH,	IF_EB("\033|4h", ESC_STR "|4h")},   // HL_ITALIC
     {(int)KS_VB,	IF_EB("\033|f", ESC_STR "|f")},
     {(int)KS_MS,	"y"},
     {(int)KS_UT,	"y"},
     {(int)KS_XN,	"y"},
-    {(int)KS_LE,	"\b"},		/* cursor-left = BS */
-    {(int)KS_ND,	"\014"},	/* cursor-right = CTRL-L */
+    {(int)KS_LE,	"\b"},		// cursor-left = BS
+    {(int)KS_ND,	"\014"},	// cursor-right = CTRL-L
 # ifdef TERMINFO
     {(int)KS_CM,	IF_EB("\033|%p1%d;%p2%dM", ESC_STR "|%p1%d;%p2%dM")},
 # else
     {(int)KS_CM,	IF_EB("\033|%d;%dM", ESC_STR "|%d;%dM")},
 # endif
-	/* there are no key sequences here, the GUI sequences are recognized
-	 * in check_termcode() */
+	// there are no key sequences here, the GUI sequences are recognized
+	// in check_termcode()
 #endif
 
 #ifndef NO_BUILTIN_TCAPS
@@ -294,18 +294,18 @@ static struct builtin_term builtin_termc
     {(int)KS_CZH,	"\033[3m"},
     {(int)KS_CZR,	"\033[0m"},
 #if defined(__MORPHOS__) || defined(__AROS__)
-    {(int)KS_CCO,	"8"},		/* allow 8 colors */
+    {(int)KS_CCO,	"8"},		// allow 8 colors
 #  ifdef TERMINFO
-    {(int)KS_CAB,	"\033[4%p1%dm"},/* set background color */
-    {(int)KS_CAF,	"\033[3%p1%dm"},/* set foreground color */
+    {(int)KS_CAB,	"\033[4%p1%dm"},// set background color
+    {(int)KS_CAF,	"\033[3%p1%dm"},// set foreground color
 #  else
-    {(int)KS_CAB,	"\033[4%dm"},	/* set background color */
-    {(int)KS_CAF,	"\033[3%dm"},	/* set foreground color */
+    {(int)KS_CAB,	"\033[4%dm"},	// set background color
+    {(int)KS_CAF,	"\033[3%dm"},	// set foreground color
 #  endif
-    {(int)KS_OP,	"\033[m"},	/* reset colors */
+    {(int)KS_OP,	"\033[m"},	// reset colors
 #endif
     {(int)KS_MS,	"y"},
-    {(int)KS_UT,	"y"},		/* guessed */
+    {(int)KS_UT,	"y"},		// guessed
     {(int)KS_LE,	"\b"},
 #  ifdef TERMINFO
     {(int)KS_CM,	"\033[%i%p1%d;%p2%dH"},
@@ -329,7 +329,7 @@ static struct builtin_term builtin_termc
     {K_S_LEFT,		"\233 A"},
     {K_S_RIGHT,		"\233 @"},
     {K_S_TAB,		"\233Z"},
-    {K_F1,		"\233\060~"},/* some compilers don't dig "\2330" */
+    {K_F1,		"\233\060~"},// some compilers don't dig "\2330"
     {K_F2,		"\233\061~"},
     {K_F3,		"\233\062~"},
     {K_F4,		"\233\063~"},
@@ -350,16 +350,16 @@ static struct builtin_term builtin_termc
     {K_S_F9,		"\233\061\070~"},
     {K_S_F10,		"\233\061\071~"},
     {K_HELP,		"\233?~"},
-    {K_INS,		"\233\064\060~"},	/* 101 key keyboard */
-    {K_PAGEUP,		"\233\064\061~"},	/* 101 key keyboard */
-    {K_PAGEDOWN,	"\233\064\062~"},	/* 101 key keyboard */
-    {K_HOME,		"\233\064\064~"},	/* 101 key keyboard */
-    {K_END,		"\233\064\065~"},	/* 101 key keyboard */
+    {K_INS,		"\233\064\060~"},	// 101 key keyboard
+    {K_PAGEUP,		"\233\064\061~"},	// 101 key keyboard
+    {K_PAGEDOWN,	"\233\064\062~"},	// 101 key keyboard
+    {K_HOME,		"\233\064\064~"},	// 101 key keyboard
+    {K_END,		"\233\064\065~"},	// 101 key keyboard
 
     {BT_EXTRA_KEYS,	""},
-    {TERMCAP2KEY('#', '2'), "\233\065\064~"},	/* shifted home key */
-    {TERMCAP2KEY('#', '3'), "\233\065\060~"},	/* shifted insert key */
-    {TERMCAP2KEY('*', '7'), "\233\065\065~"},	/* shifted end key */
+    {TERMCAP2KEY('#', '2'), "\233\065\064~"},	// shifted home key
+    {TERMCAP2KEY('#', '3'), "\233\065\060~"},	// shifted insert key
+    {TERMCAP2KEY('*', '7'), "\233\065\065~"},	// shifted end key
 # endif
 
 # if defined(__BEOS__) || defined(ALL_BUILTIN_TCAPS)
@@ -385,34 +385,34 @@ static struct builtin_term builtin_termc
 #  ifdef TERMINFO
     {(int)KS_CS,	"\033[%i%p1%d;%p2%dr"},
 #  else
-    {(int)KS_CS,	"\033[%i%d;%dr"},	/* scroll region */
+    {(int)KS_CS,	"\033[%i%d;%dr"},	// scroll region
 #  endif
 #endif
     {(int)KS_CL,	"\033[H\033[2J"},
 #ifdef notyet
-    {(int)KS_VI,	"[VI]"}, /* cursor invisible, VT320: CSI ? 25 l */
-    {(int)KS_VE,	"[VE]"}, /* cursor visible, VT320: CSI ? 25 h */
+    {(int)KS_VI,	"[VI]"}, // cursor invisible, VT320: CSI ? 25 l
+    {(int)KS_VE,	"[VE]"}, // cursor visible, VT320: CSI ? 25 h
 #endif
-    {(int)KS_ME,	"\033[m"},	/* normal mode */
-    {(int)KS_MR,	"\033[7m"},	/* reverse */
-    {(int)KS_MD,	"\033[1m"},	/* bold */
-    {(int)KS_SO,	"\033[31m"},	/* standout mode: red */
-    {(int)KS_SE,	"\033[m"},	/* standout end */
-    {(int)KS_CZH,	"\033[35m"},	/* italic: purple */
-    {(int)KS_CZR,	"\033[m"},	/* italic end */
-    {(int)KS_US,	"\033[4m"},	/* underscore mode */
-    {(int)KS_UE,	"\033[m"},	/* underscore end */
-    {(int)KS_CCO,	"8"},		/* allow 8 colors */
+    {(int)KS_ME,	"\033[m"},	// normal mode
+    {(int)KS_MR,	"\033[7m"},	// reverse
+    {(int)KS_MD,	"\033[1m"},	// bold
+    {(int)KS_SO,	"\033[31m"},	// standout mode: red
+    {(int)KS_SE,	"\033[m"},	// standout end
+    {(int)KS_CZH,	"\033[35m"},	// italic: purple
+    {(int)KS_CZR,	"\033[m"},	// italic end
+    {(int)KS_US,	"\033[4m"},	// underscore mode
+    {(int)KS_UE,	"\033[m"},	// underscore end
+    {(int)KS_CCO,	"8"},		// allow 8 colors
 #  ifdef TERMINFO
-    {(int)KS_CAB,	"\033[4%p1%dm"},/* set background color */
-    {(int)KS_CAF,	"\033[3%p1%dm"},/* set foreground color */
+    {(int)KS_CAB,	"\033[4%p1%dm"},// set background color
+    {(int)KS_CAF,	"\033[3%p1%dm"},// set foreground color
 #  else
-    {(int)KS_CAB,	"\033[4%dm"},	/* set background color */
-    {(int)KS_CAF,	"\033[3%dm"},	/* set foreground color */
+    {(int)KS_CAB,	"\033[4%dm"},	// set background color
+    {(int)KS_CAF,	"\033[3%dm"},	// set foreground color
 #  endif
-    {(int)KS_OP,	"\033[m"},	/* reset colors */
-    {(int)KS_MS,	"y"},		/* safe to move cur in reverse mode */
-    {(int)KS_UT,	"y"},		/* guessed */
+    {(int)KS_OP,	"\033[m"},	// reset colors
+    {(int)KS_MS,	"y"},		// safe to move cur in reverse mode
+    {(int)KS_UT,	"y"},		// guessed
     {(int)KS_LE,	"\b"},
 #  ifdef TERMINFO
     {(int)KS_CM,	"\033[%i%p1%d;%p2%dH"},
@@ -426,7 +426,7 @@ static struct builtin_term builtin_termc
     {(int)KS_CRI,	"\033[%dC"},
 #  endif
 #  if defined(BEOS_DR8)
-    {(int)KS_DB,	""},		/* hack! see screen.c */
+    {(int)KS_DB,	""},		// hack! see screen.c
 #  endif
 
     {K_UP,		"\033[A"},
@@ -457,7 +457,7 @@ static struct builtin_term builtin_termc
     {(int)KS_ME,	IF_EB("\033[0m", ESC_STR "[0m")},
     {(int)KS_MR,	IF_EB("\033[7m", ESC_STR "[7m")},
     {(int)KS_MS,	"y"},
-    {(int)KS_UT,	"y"},		/* guessed */
+    {(int)KS_UT,	"y"},		// guessed
     {(int)KS_LE,	"\b"},
 #  ifdef TERMINFO
     {(int)KS_CM,	IF_EB("\033[%i%p1%d;%p2%dH", ESC_STR "[%i%p1%d;%p2%dH")},
@@ -484,25 +484,25 @@ static struct builtin_term builtin_termc
     {(int)KS_CE,	"\033[K"},
     {(int)KS_CL,	"\033[2J"},
     {(int)KS_ME,	"\033[0m"},
-    {(int)KS_MR,	"\033[5m"},	/* reverse: black on lightgrey */
-    {(int)KS_MD,	"\033[1m"},	/* bold: white text */
-    {(int)KS_SE,	"\033[0m"},	/* standout end */
-    {(int)KS_SO,	"\033[31m"},	/* standout: white on blue */
-    {(int)KS_CZH,	"\033[34;43m"},	/* italic mode: blue text on yellow */
-    {(int)KS_CZR,	"\033[0m"},	/* italic mode end */
-    {(int)KS_US,	"\033[36;41m"},	/* underscore mode: cyan text on red */
-    {(int)KS_UE,	"\033[0m"},	/* underscore mode end */
-    {(int)KS_CCO,	"8"},		/* allow 8 colors */
+    {(int)KS_MR,	"\033[5m"},	// reverse: black on lightgrey
+    {(int)KS_MD,	"\033[1m"},	// bold: white text
+    {(int)KS_SE,	"\033[0m"},	// standout end
+    {(int)KS_SO,	"\033[31m"},	// standout: white on blue
+    {(int)KS_CZH,	"\033[34;43m"},	// italic mode: blue text on yellow
+    {(int)KS_CZR,	"\033[0m"},	// italic mode end
+    {(int)KS_US,	"\033[36;41m"},	// underscore mode: cyan text on red
+    {(int)KS_UE,	"\033[0m"},	// underscore mode end
+    {(int)KS_CCO,	"8"},		// allow 8 colors
 #  ifdef TERMINFO
-    {(int)KS_CAB,	"\033[4%p1%dm"},/* set background color */
-    {(int)KS_CAF,	"\033[3%p1%dm"},/* set foreground color */
+    {(int)KS_CAB,	"\033[4%p1%dm"},// set background color
+    {(int)KS_CAF,	"\033[3%p1%dm"},// set foreground color
 #  else
-    {(int)KS_CAB,	"\033[4%dm"},	/* set background color */
-    {(int)KS_CAF,	"\033[3%dm"},	/* set foreground color */
+    {(int)KS_CAB,	"\033[4%dm"},	// set background color
+    {(int)KS_CAF,	"\033[3%dm"},	// set foreground color
 #  endif
-    {(int)KS_OP,	"\033[0m"},	/* reset colors */
+    {(int)KS_OP,	"\033[0m"},	// reset colors
     {(int)KS_MS,	"y"},
-    {(int)KS_UT,	"y"},		/* guessed */
+    {(int)KS_UT,	"y"},		// guessed
     {(int)KS_LE,	"\b"},
 #  ifdef TERMINFO
     {(int)KS_CM,	"\033[%i%p1%d;%p2%dH"},
@@ -530,8 +530,8 @@ static struct builtin_term builtin_termc
     {K_F8,		"\316B"},
     {K_F9,		"\316C"},
     {K_F10,		"\316D"},
-    {K_F11,		"\316\205"},	/* guessed */
-    {K_F12,		"\316\206"},	/* guessed */
+    {K_F11,		"\316\205"},	// guessed
+    {K_F12,		"\316\206"},	// guessed
     {K_S_F1,		"\316T"},
     {K_S_F2,		"\316U"},
     {K_S_F3,		"\316V"},
@@ -542,8 +542,8 @@ static struct builtin_term builtin_termc
     {K_S_F8,		"\316["},
     {K_S_F9,		"\316\\"},
     {K_S_F10,		"\316]"},
-    {K_S_F11,		"\316\207"},	/* guessed */
-    {K_S_F12,		"\316\210"},	/* guessed */
+    {K_S_F11,		"\316\207"},	// guessed
+    {K_S_F12,		"\316\210"},	// guessed
     {K_INS,		"\316R"},
     {K_DEL,		"\316S"},
     {K_HOME,		"\316G"},
@@ -708,19 +708,19 @@ static struct builtin_term builtin_termc
 #  endif
     {(int)KS_CL,	IF_EB("\033[H\033[2J", ESC_STR "[H" ESC_STR_nc "[2J")},
     {(int)KS_CD,	IF_EB("\033[J", ESC_STR "[J")},
-    {(int)KS_CCO,	"8"},			/* allow 8 colors */
+    {(int)KS_CCO,	"8"},			// allow 8 colors
     {(int)KS_ME,	IF_EB("\033[0m", ESC_STR "[0m")},
     {(int)KS_MR,	IF_EB("\033[7m", ESC_STR "[7m")},
-    {(int)KS_MD,	IF_EB("\033[1m", ESC_STR "[1m")},  /* bold mode */
-    {(int)KS_SE,	IF_EB("\033[22m", ESC_STR "[22m")},/* normal mode */
-    {(int)KS_UE,	IF_EB("\033[24m", ESC_STR "[24m")},/* exit underscore mode */
-    {(int)KS_US,	IF_EB("\033[4m", ESC_STR "[4m")},  /* underscore mode */
-    {(int)KS_CZH,	IF_EB("\033[34;43m", ESC_STR "[34;43m")},  /* italic mode: blue text on yellow */
-    {(int)KS_CZR,	IF_EB("\033[0m", ESC_STR "[0m")},	    /* italic mode end */
-    {(int)KS_CAB,	IF_EB("\033[4%dm", ESC_STR "[4%dm")},	    /* set background color (ANSI) */
-    {(int)KS_CAF,	IF_EB("\033[3%dm", ESC_STR "[3%dm")},	    /* set foreground color (ANSI) */
-    {(int)KS_CSB,	IF_EB("\033[102;%dm", ESC_STR "[102;%dm")},	/* set screen background color */
-    {(int)KS_CSF,	IF_EB("\033[101;%dm", ESC_STR "[101;%dm")},	/* set screen foreground color */
+    {(int)KS_MD,	IF_EB("\033[1m", ESC_STR "[1m")},  // bold mode
+    {(int)KS_SE,	IF_EB("\033[22m", ESC_STR "[22m")},// normal mode
+    {(int)KS_UE,	IF_EB("\033[24m", ESC_STR "[24m")},// exit underscore mode
+    {(int)KS_US,	IF_EB("\033[4m", ESC_STR "[4m")},  // underscore mode
+    {(int)KS_CZH,	IF_EB("\033[34;43m", ESC_STR "[34;43m")},  // italic mode: blue text on yellow
+    {(int)KS_CZR,	IF_EB("\033[0m", ESC_STR "[0m")},	    // italic mode end
+    {(int)KS_CAB,	IF_EB("\033[4%dm", ESC_STR "[4%dm")},	    // set background color (ANSI)
+    {(int)KS_CAF,	IF_EB("\033[3%dm", ESC_STR "[3%dm")},	    // set foreground color (ANSI)
+    {(int)KS_CSB,	IF_EB("\033[102;%dm", ESC_STR "[102;%dm")},	// set screen background color
+    {(int)KS_CSF,	IF_EB("\033[101;%dm", ESC_STR "[101;%dm")},	// set screen foreground color
     {(int)KS_MS,	"y"},
     {(int)KS_UT,	"y"},
     {(int)KS_XN,	"y"},
@@ -756,8 +756,8 @@ static struct builtin_term builtin_termc
     {K_F12,		IF_EB("\033[24~", ESC_STR "[24~")},
     {K_F13,		IF_EB("\033[25~", ESC_STR "[25~")},
     {K_F14,		IF_EB("\033[26~", ESC_STR "[26~")},
-    {K_F15,		IF_EB("\033[28~", ESC_STR "[28~")},	/* Help */
-    {K_F16,		IF_EB("\033[29~", ESC_STR "[29~")},	/* Select */
+    {K_F15,		IF_EB("\033[28~", ESC_STR "[28~")},	// Help
+    {K_F16,		IF_EB("\033[29~", ESC_STR "[29~")},	// Select
     {K_F17,		IF_EB("\033[31~", ESC_STR "[31~")},
     {K_F18,		IF_EB("\033[32~", ESC_STR "[32~")},
     {K_F19,		IF_EB("\033[33~", ESC_STR "[33~")},
@@ -770,22 +770,22 @@ static struct builtin_term builtin_termc
     {K_PAGEDOWN,	IF_EB("\033[6~", ESC_STR "[6~")},
     // These sequences starting with <Esc> O may interfere with what the user
     // is typing.  Remove these if that bothers you.
-    {K_KPLUS,		IF_EB("\033Ok", ESC_STR "Ok")},	/* keypad plus */
-    {K_KMINUS,		IF_EB("\033Om", ESC_STR "Om")},	/* keypad minus */
-    {K_KDIVIDE,		IF_EB("\033Oo", ESC_STR "Oo")},	/* keypad / */
-    {K_KMULTIPLY,	IF_EB("\033Oj", ESC_STR "Oj")},	/* keypad * */
-    {K_KENTER,		IF_EB("\033OM", ESC_STR "OM")},	/* keypad Enter */
-    {K_K0,		IF_EB("\033Op", ESC_STR "Op")},	/* keypad 0 */
-    {K_K1,		IF_EB("\033Oq", ESC_STR "Oq")},	/* keypad 1 */
-    {K_K2,		IF_EB("\033Or", ESC_STR "Or")},	/* keypad 2 */
-    {K_K3,		IF_EB("\033Os", ESC_STR "Os")},	/* keypad 3 */
-    {K_K4,		IF_EB("\033Ot", ESC_STR "Ot")},	/* keypad 4 */
-    {K_K5,		IF_EB("\033Ou", ESC_STR "Ou")},	/* keypad 5 */
-    {K_K6,		IF_EB("\033Ov", ESC_STR "Ov")},	/* keypad 6 */
-    {K_K7,		IF_EB("\033Ow", ESC_STR "Ow")},	/* keypad 7 */
-    {K_K8,		IF_EB("\033Ox", ESC_STR "Ox")},	/* keypad 8 */
-    {K_K9,		IF_EB("\033Oy", ESC_STR "Oy")},	/* keypad 9 */
-    {K_BS,		"\x7f"},	/* for some reason 0177 doesn't work */
+    {K_KPLUS,		IF_EB("\033Ok", ESC_STR "Ok")},	// keypad plus
+    {K_KMINUS,		IF_EB("\033Om", ESC_STR "Om")},	// keypad minus
+    {K_KDIVIDE,		IF_EB("\033Oo", ESC_STR "Oo")},	// keypad /
+    {K_KMULTIPLY,	IF_EB("\033Oj", ESC_STR "Oj")},	// keypad *
+    {K_KENTER,		IF_EB("\033OM", ESC_STR "OM")},	// keypad Enter
+    {K_K0,		IF_EB("\033Op", ESC_STR "Op")},	// keypad 0
+    {K_K1,		IF_EB("\033Oq", ESC_STR "Oq")},	// keypad 1
+    {K_K2,		IF_EB("\033Or", ESC_STR "Or")},	// keypad 2
+    {K_K3,		IF_EB("\033Os", ESC_STR "Os")},	// keypad 3
+    {K_K4,		IF_EB("\033Ot", ESC_STR "Ot")},	// keypad 4
+    {K_K5,		IF_EB("\033Ou", ESC_STR "Ou")},	// keypad 5
+    {K_K6,		IF_EB("\033Ov", ESC_STR "Ov")},	// keypad 6
+    {K_K7,		IF_EB("\033Ow", ESC_STR "Ow")},	// keypad 7
+    {K_K8,		IF_EB("\033Ox", ESC_STR "Ox")},	// keypad 8
+    {K_K9,		IF_EB("\033Oy", ESC_STR "Oy")},	// keypad 9
+    {K_BS,		"\x7f"},	// for some reason 0177 doesn't work
 # endif
 
 # if defined(ALL_BUILTIN_TCAPS) || defined(__MINT__)
@@ -936,7 +936,7 @@ static struct builtin_term builtin_termc
     {(int)KS_RBG,	IF_EB("\033]11;?\007", ESC_STR "]11;?\007")},
     {(int)KS_U7,	IF_EB("\033[6n", ESC_STR "[6n")},
 #  ifdef FEAT_TERMGUICOLORS
-    /* These are printf strings, not terminal codes. */
+    // These are printf strings, not terminal codes.
     {(int)KS_8F,	IF_EB("\033[38;2;%lu;%lu;%lum", ESC_STR "[38;2;%lu;%lu;%lum")},
     {(int)KS_8B,	IF_EB("\033[48;2;%lu;%lu;%lum", ESC_STR "[48;2;%lu;%lu;%lum")},
 #  endif
@@ -951,12 +951,12 @@ static struct builtin_term builtin_termc
     {K_DOWN,		IF_EB("\033O*B", ESC_STR "O*B")},
     {K_RIGHT,		IF_EB("\033O*C", ESC_STR "O*C")},
     {K_LEFT,		IF_EB("\033O*D", ESC_STR "O*D")},
-    /* An extra set of cursor keys for vt100 mode */
+    // An extra set of cursor keys for vt100 mode
     {K_XUP,		IF_EB("\033[1;*A", ESC_STR "[1;*A")},
     {K_XDOWN,		IF_EB("\033[1;*B", ESC_STR "[1;*B")},
     {K_XRIGHT,		IF_EB("\033[1;*C", ESC_STR "[1;*C")},
     {K_XLEFT,		IF_EB("\033[1;*D", ESC_STR "[1;*D")},
-    /* An extra set of function keys for vt100 mode */
+    // An extra set of function keys for vt100 mode
     {K_XF1,		IF_EB("\033O*P", ESC_STR "O*P")},
     {K_XF2,		IF_EB("\033O*Q", ESC_STR "O*Q")},
     {K_XF3,		IF_EB("\033O*R", ESC_STR "O*R")},
@@ -978,68 +978,68 @@ static struct builtin_term builtin_termc
     {K_UNDO,		IF_EB("\033[26;*~", ESC_STR "[26;*~")},
     {K_INS,		IF_EB("\033[2;*~", ESC_STR "[2;*~")},
     {K_HOME,		IF_EB("\033[1;*H", ESC_STR "[1;*H")},
-    /* {K_S_HOME,		IF_EB("\033O2H", ESC_STR "O2H")}, */
-    /* {K_C_HOME,		IF_EB("\033O5H", ESC_STR "O5H")}, */
+    // {K_S_HOME,		IF_EB("\033O2H", ESC_STR "O2H")},
+    // {K_C_HOME,		IF_EB("\033O5H", ESC_STR "O5H")},
     {K_KHOME,		IF_EB("\033[1;*~", ESC_STR "[1;*~")},
-    {K_XHOME,		IF_EB("\033O*H", ESC_STR "O*H")},	/* other Home */
-    {K_ZHOME,		IF_EB("\033[7;*~", ESC_STR "[7;*~")},	/* other Home */
+    {K_XHOME,		IF_EB("\033O*H", ESC_STR "O*H")},	// other Home
+    {K_ZHOME,		IF_EB("\033[7;*~", ESC_STR "[7;*~")},	// other Home
     {K_END,		IF_EB("\033[1;*F", ESC_STR "[1;*F")},
-    /* {K_S_END,		IF_EB("\033O2F", ESC_STR "O2F")}, */
-    /* {K_C_END,		IF_EB("\033O5F", ESC_STR "O5F")}, */
+    // {K_S_END,		IF_EB("\033O2F", ESC_STR "O2F")},
+    // {K_C_END,		IF_EB("\033O5F", ESC_STR "O5F")},
     {K_KEND,		IF_EB("\033[4;*~", ESC_STR "[4;*~")},
-    {K_XEND,		IF_EB("\033O*F", ESC_STR "O*F")},	/* other End */
+    {K_XEND,		IF_EB("\033O*F", ESC_STR "O*F")},	// other End
     {K_ZEND,		IF_EB("\033[8;*~", ESC_STR "[8;*~")},
     {K_PAGEUP,		IF_EB("\033[5;*~", ESC_STR "[5;*~")},
     {K_PAGEDOWN,	IF_EB("\033[6;*~", ESC_STR "[6;*~")},
-    {K_KPLUS,		IF_EB("\033O*k", ESC_STR "O*k")},     /* keypad plus */
-    {K_KMINUS,		IF_EB("\033O*m", ESC_STR "O*m")},     /* keypad minus */
-    {K_KDIVIDE,		IF_EB("\033O*o", ESC_STR "O*o")},     /* keypad / */
-    {K_KMULTIPLY,	IF_EB("\033O*j", ESC_STR "O*j")},     /* keypad * */
-    {K_KENTER,		IF_EB("\033O*M", ESC_STR "O*M")},     /* keypad Enter */
-    {K_KPOINT,		IF_EB("\033O*n", ESC_STR "O*n")},     /* keypad . */
-    {K_K0,		IF_EB("\033O*p", ESC_STR "O*p")},     /* keypad 0 */
-    {K_K1,		IF_EB("\033O*q", ESC_STR "O*q")},     /* keypad 1 */
-    {K_K2,		IF_EB("\033O*r", ESC_STR "O*r")},     /* keypad 2 */
-    {K_K3,		IF_EB("\033O*s", ESC_STR "O*s")},     /* keypad 3 */
-    {K_K4,		IF_EB("\033O*t", ESC_STR "O*t")},     /* keypad 4 */
-    {K_K5,		IF_EB("\033O*u", ESC_STR "O*u")},     /* keypad 5 */
-    {K_K6,		IF_EB("\033O*v", ESC_STR "O*v")},     /* keypad 6 */
-    {K_K7,		IF_EB("\033O*w", ESC_STR "O*w")},     /* keypad 7 */
-    {K_K8,		IF_EB("\033O*x", ESC_STR "O*x")},     /* keypad 8 */
-    {K_K9,		IF_EB("\033O*y", ESC_STR "O*y")},     /* keypad 9 */
-    {K_KDEL,		IF_EB("\033[3;*~", ESC_STR "[3;*~")}, /* keypad Del */
-    {K_PS,		IF_EB("\033[200~", ESC_STR "[200~")}, /* paste start */
-    {K_PE,		IF_EB("\033[201~", ESC_STR "[201~")}, /* paste end */
+    {K_KPLUS,		IF_EB("\033O*k", ESC_STR "O*k")},     // keypad plus
+    {K_KMINUS,		IF_EB("\033O*m", ESC_STR "O*m")},     // keypad minus
+    {K_KDIVIDE,		IF_EB("\033O*o", ESC_STR "O*o")},     // keypad /
+    {K_KMULTIPLY,	IF_EB("\033O*j", ESC_STR "O*j")},     // keypad *
+    {K_KENTER,		IF_EB("\033O*M", ESC_STR "O*M")},     // keypad Enter
+    {K_KPOINT,		IF_EB("\033O*n", ESC_STR "O*n")},     // keypad .
+    {K_K0,		IF_EB("\033O*p", ESC_STR "O*p")},     // keypad 0
+    {K_K1,		IF_EB("\033O*q", ESC_STR "O*q")},     // keypad 1
+    {K_K2,		IF_EB("\033O*r", ESC_STR "O*r")},     // keypad 2
+    {K_K3,		IF_EB("\033O*s", ESC_STR "O*s")},     // keypad 3
+    {K_K4,		IF_EB("\033O*t", ESC_STR "O*t")},     // keypad 4
+    {K_K5,		IF_EB("\033O*u", ESC_STR "O*u")},     // keypad 5
+    {K_K6,		IF_EB("\033O*v", ESC_STR "O*v")},     // keypad 6
+    {K_K7,		IF_EB("\033O*w", ESC_STR "O*w")},     // keypad 7
+    {K_K8,		IF_EB("\033O*x", ESC_STR "O*x")},     // keypad 8
+    {K_K9,		IF_EB("\033O*y", ESC_STR "O*y")},     // keypad 9
+    {K_KDEL,		IF_EB("\033[3;*~", ESC_STR "[3;*~")}, // keypad Del
+    {K_PS,		IF_EB("\033[200~", ESC_STR "[200~")}, // paste start
+    {K_PE,		IF_EB("\033[201~", ESC_STR "[201~")}, // paste end
 
     {BT_EXTRA_KEYS,   ""},
-    {TERMCAP2KEY('k', '0'), IF_EB("\033[10;*~", ESC_STR "[10;*~")}, /* F0 */
-    {TERMCAP2KEY('F', '3'), IF_EB("\033[25;*~", ESC_STR "[25;*~")}, /* F13 */
-    /* F14 and F15 are missing, because they send the same codes as the undo
-     * and help key, although they don't work on all keyboards. */
-    {TERMCAP2KEY('F', '6'), IF_EB("\033[29;*~", ESC_STR "[29;*~")}, /* F16 */
-    {TERMCAP2KEY('F', '7'), IF_EB("\033[31;*~", ESC_STR "[31;*~")}, /* F17 */
-    {TERMCAP2KEY('F', '8'), IF_EB("\033[32;*~", ESC_STR "[32;*~")}, /* F18 */
-    {TERMCAP2KEY('F', '9'), IF_EB("\033[33;*~", ESC_STR "[33;*~")}, /* F19 */
-    {TERMCAP2KEY('F', 'A'), IF_EB("\033[34;*~", ESC_STR "[34;*~")}, /* F20 */
-
-    {TERMCAP2KEY('F', 'B'), IF_EB("\033[42;*~", ESC_STR "[42;*~")}, /* F21 */
-    {TERMCAP2KEY('F', 'C'), IF_EB("\033[43;*~", ESC_STR "[43;*~")}, /* F22 */
-    {TERMCAP2KEY('F', 'D'), IF_EB("\033[44;*~", ESC_STR "[44;*~")}, /* F23 */
-    {TERMCAP2KEY('F', 'E'), IF_EB("\033[45;*~", ESC_STR "[45;*~")}, /* F24 */
-    {TERMCAP2KEY('F', 'F'), IF_EB("\033[46;*~", ESC_STR "[46;*~")}, /* F25 */
-    {TERMCAP2KEY('F', 'G'), IF_EB("\033[47;*~", ESC_STR "[47;*~")}, /* F26 */
-    {TERMCAP2KEY('F', 'H'), IF_EB("\033[48;*~", ESC_STR "[48;*~")}, /* F27 */
-    {TERMCAP2KEY('F', 'I'), IF_EB("\033[49;*~", ESC_STR "[49;*~")}, /* F28 */
-    {TERMCAP2KEY('F', 'J'), IF_EB("\033[50;*~", ESC_STR "[50;*~")}, /* F29 */
-    {TERMCAP2KEY('F', 'K'), IF_EB("\033[51;*~", ESC_STR "[51;*~")}, /* F30 */
-
-    {TERMCAP2KEY('F', 'L'), IF_EB("\033[52;*~", ESC_STR "[52;*~")}, /* F31 */
-    {TERMCAP2KEY('F', 'M'), IF_EB("\033[53;*~", ESC_STR "[53;*~")}, /* F32 */
-    {TERMCAP2KEY('F', 'N'), IF_EB("\033[54;*~", ESC_STR "[54;*~")}, /* F33 */
-    {TERMCAP2KEY('F', 'O'), IF_EB("\033[55;*~", ESC_STR "[55;*~")}, /* F34 */
-    {TERMCAP2KEY('F', 'P'), IF_EB("\033[56;*~", ESC_STR "[56;*~")}, /* F35 */
-    {TERMCAP2KEY('F', 'Q'), IF_EB("\033[57;*~", ESC_STR "[57;*~")}, /* F36 */
-    {TERMCAP2KEY('F', 'R'), IF_EB("\033[58;*~", ESC_STR "[58;*~")}, /* F37 */
+    {TERMCAP2KEY('k', '0'), IF_EB("\033[10;*~", ESC_STR "[10;*~")}, // F0
+    {TERMCAP2KEY('F', '3'), IF_EB("\033[25;*~", ESC_STR "[25;*~")}, // F13
+    // F14 and F15 are missing, because they send the same codes as the undo
+    // and help key, although they don't work on all keyboards.
+    {TERMCAP2KEY('F', '6'), IF_EB("\033[29;*~", ESC_STR "[29;*~")}, // F16
+    {TERMCAP2KEY('F', '7'), IF_EB("\033[31;*~", ESC_STR "[31;*~")}, // F17
+    {TERMCAP2KEY('F', '8'), IF_EB("\033[32;*~", ESC_STR "[32;*~")}, // F18
+    {TERMCAP2KEY('F', '9'), IF_EB("\033[33;*~", ESC_STR "[33;*~")}, // F19
+    {TERMCAP2KEY('F', 'A'), IF_EB("\033[34;*~", ESC_STR "[34;*~")}, // F20
+
+    {TERMCAP2KEY('F', 'B'), IF_EB("\033[42;*~", ESC_STR "[42;*~")}, // F21
+    {TERMCAP2KEY('F', 'C'), IF_EB("\033[43;*~", ESC_STR "[43;*~")}, // F22
+    {TERMCAP2KEY('F', 'D'), IF_EB("\033[44;*~", ESC_STR "[44;*~")}, // F23
+    {TERMCAP2KEY('F', 'E'), IF_EB("\033[45;*~", ESC_STR "[45;*~")}, // F24
+    {TERMCAP2KEY('F', 'F'), IF_EB("\033[46;*~", ESC_STR "[46;*~")}, // F25
+    {TERMCAP2KEY('F', 'G'), IF_EB("\033[47;*~", ESC_STR "[47;*~")}, // F26
+    {TERMCAP2KEY('F', 'H'), IF_EB("\033[48;*~", ESC_STR "[48;*~")}, // F27
+    {TERMCAP2KEY('F', 'I'), IF_EB("\033[49;*~", ESC_STR "[49;*~")}, // F28
+    {TERMCAP2KEY('F', 'J'), IF_EB("\033[50;*~", ESC_STR "[50;*~")}, // F29
+    {TERMCAP2KEY('F', 'K'), IF_EB("\033[51;*~", ESC_STR "[51;*~")}, // F30
+
+    {TERMCAP2KEY('F', 'L'), IF_EB("\033[52;*~", ESC_STR "[52;*~")}, // F31
+    {TERMCAP2KEY('F', 'M'), IF_EB("\033[53;*~", ESC_STR "[53;*~")}, // F32
+    {TERMCAP2KEY('F', 'N'), IF_EB("\033[54;*~", ESC_STR "[54;*~")}, // F33
+    {TERMCAP2KEY('F', 'O'), IF_EB("\033[55;*~", ESC_STR "[55;*~")}, // F34
+    {TERMCAP2KEY('F', 'P'), IF_EB("\033[56;*~", ESC_STR "[56;*~")}, // F35
+    {TERMCAP2KEY('F', 'Q'), IF_EB("\033[57;*~", ESC_STR "[57;*~")}, // F36
+    {TERMCAP2KEY('F', 'R'), IF_EB("\033[58;*~", ESC_STR "[58;*~")}, // F37
 # endif
 
 # if defined(UNIX) || defined(ALL_BUILTIN_TCAPS)
@@ -1061,7 +1061,7 @@ static struct builtin_term builtin_termc
 #  else
     {(int)KS_CDL,	"\033[%dM"},
 #  endif
-#if 0	/* The scroll region is not working as Vim expects. */
+#if 0	// The scroll region is not working as Vim expects.
 #  ifdef TERMINFO
     {(int)KS_CS,	"\033[%i%p1%d;%p2%dr"},
 #  else
@@ -1069,8 +1069,8 @@ static struct builtin_term builtin_termc
 #  endif
 #endif
     {(int)KS_CL,	"\033[H\033[2J"},
-    {(int)KS_VE,	"\033[9/y\033[12/y"},	/* These aren't documented */
-    {(int)KS_VS,	"\033[10/y\033[=1h\033[=2l"}, /* These aren't documented */
+    {(int)KS_VE,	"\033[9/y\033[12/y"},	// These aren't documented
+    {(int)KS_VS,	"\033[10/y\033[=1h\033[=2l"}, // These aren't documented
     {(int)KS_TI,	"\033[=6h"},
     {(int)KS_TE,	"\033[=6l"},
     {(int)KS_SE,	"\033[21;27m"},
@@ -1078,24 +1078,24 @@ static struct builtin_term builtin_termc
     {(int)KS_ME,	"\033[m"},
     {(int)KS_MR,	"\033[7m"},
     {(int)KS_MD,	"\033[1m"},
-    {(int)KS_CCO,	"8"},			/* allow 8 colors */
-    {(int)KS_CZH,	"\033[3m"},		/* italic mode on */
-    {(int)KS_CZR,	"\033[23m"},		/* italic mode off */
-    {(int)KS_US,	"\033[4m"},		/* underline on */
-    {(int)KS_UE,	"\033[24m"},		/* underline off */
+    {(int)KS_CCO,	"8"},			// allow 8 colors
+    {(int)KS_CZH,	"\033[3m"},		// italic mode on
+    {(int)KS_CZR,	"\033[23m"},		// italic mode off
+    {(int)KS_US,	"\033[4m"},		// underline on
+    {(int)KS_UE,	"\033[24m"},		// underline off
 #  ifdef TERMINFO
-    {(int)KS_CAB,	"\033[4%p1%dm"},    /* set background color (ANSI) */
-    {(int)KS_CAF,	"\033[3%p1%dm"},    /* set foreground color (ANSI) */
-    {(int)KS_CSB,	"\033[102;%p1%dm"}, /* set screen background color */
-    {(int)KS_CSF,	"\033[101;%p1%dm"}, /* set screen foreground color */
+    {(int)KS_CAB,	"\033[4%p1%dm"},    // set background color (ANSI)
+    {(int)KS_CAF,	"\033[3%p1%dm"},    // set foreground color (ANSI)
+    {(int)KS_CSB,	"\033[102;%p1%dm"}, // set screen background color
+    {(int)KS_CSF,	"\033[101;%p1%dm"}, // set screen foreground color
 #  else
-    {(int)KS_CAB,	"\033[4%dm"},	    /* set background color (ANSI) */
-    {(int)KS_CAF,	"\033[3%dm"},	    /* set foreground color (ANSI) */
-    {(int)KS_CSB,	"\033[102;%dm"},    /* set screen background color */
-    {(int)KS_CSF,	"\033[101;%dm"},    /* set screen foreground color */
+    {(int)KS_CAB,	"\033[4%dm"},	    // set background color (ANSI)
+    {(int)KS_CAF,	"\033[3%dm"},	    // set foreground color (ANSI)
+    {(int)KS_CSB,	"\033[102;%dm"},    // set screen background color
+    {(int)KS_CSF,	"\033[101;%dm"},    // set screen foreground color
 #  endif
-    {(int)KS_MS,	"y"},		/* guessed */
-    {(int)KS_UT,	"y"},		/* guessed */
+    {(int)KS_MS,	"y"},		// guessed
+    {(int)KS_UT,	"y"},		// guessed
     {(int)KS_LE,	"\b"},
 #  ifdef TERMINFO
     {(int)KS_CM,	"\033[%i%p1%d;%p2%dH"},
@@ -1109,9 +1109,9 @@ static struct builtin_term builtin_termc
     {(int)KS_CRI,	"\033[%dC"},
 #  endif
     {(int)KS_CIS,	"\033P3.y"},
-    {(int)KS_CIE,	"\234"},    /* ST "String Terminator" */
+    {(int)KS_CIE,	"\234"},    // ST "String Terminator"
     {(int)KS_TS,	"\033P1.y"},
-    {(int)KS_FS,	"\234"},    /* ST "String Terminator" */
+    {(int)KS_FS,	"\234"},    // ST "String Terminator"
 #  ifdef TERMINFO
     {(int)KS_CWS,	"\033[203;%p1%d;%p2%d/y"},
     {(int)KS_CWP,	"\033[205;%p1%d;%p2%d/y"},
@@ -1342,7 +1342,7 @@ static struct builtin_term builtin_termc
     {K_K9,		"[K9]"},
 # endif
 
-#endif /* NO_BUILTIN_TCAPS */
+#endif // NO_BUILTIN_TCAPS
 
 /*
  * The most minimal terminal: only clear screen and cursor positioning
@@ -1362,7 +1362,7 @@ static struct builtin_term builtin_termc
  */
     {(int)KS_NAME,	NULL}
 
-};	/* end of builtin_termcaps */
+};	// end of builtin_termcaps
 
 #if defined(FEAT_TERMGUICOLORS) || defined(PROTO)
     static guicolor_T
@@ -1431,11 +1431,11 @@ termgui_mch_get_rgb(guicolor_T color)
  */
 char_u *(term_strings[(int)KS_LAST + 1]);
 
-static int	need_gather = FALSE;	    /* need to fill termleader[] */
-static char_u	termleader[256 + 1];	    /* for check_termcode() */
+static int	need_gather = FALSE;	    // need to fill termleader[]
+static char_u	termleader[256 + 1];	    // for check_termcode()
 #ifdef FEAT_TERMRESPONSE
-static int	check_for_codes = FALSE;    /* check for key code response */
-static int	is_not_xterm = FALSE;	    /* recognized not-really-xterm */
+static int	check_for_codes = FALSE;    // check for key code response
+static int	is_not_xterm = FALSE;	    // recognized not-really-xterm
 #endif
 
     static struct builtin_term *
@@ -1483,22 +1483,22 @@ parse_builtin_tcap(char_u *term)
     p = find_builtin_term(term);
     term_8bit = term_is_8bit(term);
 
-    /* Do not parse if builtin term not found */
+    // Do not parse if builtin term not found
     if (p->bt_string == NULL)
 	return;
 
     for (++p; p->bt_entry != (int)KS_NAME && p->bt_entry != BT_EXTRA_KEYS; ++p)
     {
-	if ((int)p->bt_entry >= 0)	/* KS_xx entry */
+	if ((int)p->bt_entry >= 0)	// KS_xx entry
 	{
-	    /* Only set the value if it wasn't set yet. */
+	    // Only set the value if it wasn't set yet.
 	    if (term_strings[p->bt_entry] == NULL
 				 || term_strings[p->bt_entry] == empty_option)
 	    {
 #ifdef FEAT_EVAL
 		int opt_idx = -1;
 #endif
-		/* 8bit terminal: use CSI instead of <Esc>[ */
+		// 8bit terminal: use CSI instead of <Esc>[
 		if (term_8bit && term_7to8bit((char_u *)p->bt_string) != 0)
 		{
 		    char_u  *s, *t;
@@ -1550,7 +1550,7 @@ parse_builtin_tcap(char_u *term)
     static void
 set_color_count(int nr)
 {
-    char_u	nr_colors[20];		/* string for number of colors */
+    char_u	nr_colors[20];		// string for number of colors
 
     t_colors = nr;
     if (t_colors > 1)
@@ -1569,10 +1569,10 @@ may_adjust_color_count(int val)
 {
     if (val != t_colors)
     {
-	/* Nr of colors changed, initialize highlighting and
-	 * redraw everything.  This causes a redraw, which usually
-	 * clears the message.  Try keeping the message if it
-	 * might work. */
+	// Nr of colors changed, initialize highlighting and
+	// redraw everything.  This causes a redraw, which usually
+	// clears the message.  Try keeping the message if it
+	// might work.
 	set_keep_msg_from_hist();
 	set_color_count(val);
 	init_highlight(TRUE, FALSE);
@@ -1593,7 +1593,7 @@ may_adjust_color_count(int val)
 static char *(key_names[]) =
 {
 #ifdef FEAT_TERMRESPONSE
-    /* Do this one first, it may cause a screen redraw. */
+    // Do this one first, it may cause a screen redraw.
     "Co",
 #endif
     "ku", "kd", "kr", "kl",
@@ -1611,8 +1611,8 @@ static char *(key_names[]) =
 get_term_entries(int *height, int *width)
 {
     static struct {
-		    enum SpecialKey dest; /* index in term_strings[] */
-		    char *name;		  /* termcap name for string */
+		    enum SpecialKey dest; // index in term_strings[]
+		    char *name;		  // termcap name for string
 		  } string_names[] =
 		    {	{KS_CE, "ce"}, {KS_AL, "al"}, {KS_CAL,"AL"},
 			{KS_DL, "dl"}, {KS_CDL,"DL"}, {KS_CS, "cs"},
@@ -1664,8 +1664,8 @@ get_term_entries(int *height, int *width
 	}
     }
 
-    /* tgetflag() returns 1 if the flag is present, 0 if not and
-     * possibly -1 if the flag doesn't exist. */
+    // tgetflag() returns 1 if the flag is present, 0 if not and
+    // possibly -1 if the flag doesn't exist.
     if ((T_MS == NULL || T_MS == empty_option) && tgetflag("ms") > 0)
 	T_MS = (char_u *)"y";
     if ((T_XS == NULL || T_XS == empty_option) && tgetflag("xs") > 0)
@@ -1686,7 +1686,7 @@ get_term_entries(int *height, int *width
 	if (find_termcode((char_u *)key_names[i]) == NULL)
 	{
 	    p = TGETSTR(key_names[i], &tp);
-	    /* if cursor-left == backspace, ignore it (televideo 925) */
+	    // if cursor-left == backspace, ignore it (televideo 925)
 	    if (p != NULL
 		    && (*p != Ctrl_H
 			|| key_names[i][0] != 'k'
@@ -1758,7 +1758,7 @@ report_default_term(char_u *term)
     mch_errmsg("'\r\n");
     if (emsg_silent == 0)
     {
-	screen_start();	/* don't know where cursor is now */
+	screen_start();	// don't know where cursor is now
 	out_flush();
 	if (!is_not_a_term())
 	    ui_delay(2007L, TRUE);
@@ -1784,11 +1784,11 @@ set_termname(char_u *term)
     char	*error_msg = NULL;
     char_u	*bs_p, *del_p;
 
-    /* In silect mode (ex -s) we don't use the 'term' option. */
+    // In silect mode (ex -s) we don't use the 'term' option.
     if (silent_mode)
 	return OK;
 
-    detected_8bit = FALSE;		/* reset 8-bit detection */
+    detected_8bit = FALSE;		// reset 8-bit detection
 
     if (term_is_builtin(term))
     {
@@ -1826,15 +1826,15 @@ set_termname(char_u *term)
 	    {
 		if (!termcap_cleared)
 		{
-		    clear_termoptions();	/* clear old options */
+		    clear_termoptions();	// clear old options
 		    termcap_cleared = TRUE;
 		}
 
 		get_term_entries(&height, &width);
 	    }
 	}
-	else	    /* try == 0 || try == 2 */
-#endif /* HAVE_TGETENT */
+	else	    // try == 0 || try == 2
+#endif // HAVE_TGETENT
 	/*
 	 * Use builtin termcap
 	 */
@@ -1851,7 +1851,7 @@ set_termname(char_u *term)
 	     * search for 'term' in builtin_termcaps[]
 	     */
 	    termp = find_builtin_term(term);
-	    if (termp->bt_string == NULL)	/* did not find it */
+	    if (termp->bt_string == NULL)	// did not find it
 	    {
 #ifdef HAVE_TGETENT
 		/*
@@ -1861,17 +1861,17 @@ set_termname(char_u *term)
 		 * don't complain about not finding the term in the builtin
 		 * termcap.
 		 */
-		if (try == 0)			/* try external one */
+		if (try == 0)			// try external one
 		    continue;
-		if (termcap_cleared)		/* found in external termcap */
+		if (termcap_cleared)		// found in external termcap
 		    break;
 #endif
 		report_term_error(error_msg, term);
 
-		/* when user typed :set term=xxx, quit here */
+		// when user typed :set term=xxx, quit here
 		if (starting != NO_SCREEN)
 		{
-		    screen_start();	/* don't know where cursor is now */
+		    screen_start();	// don't know where cursor is now
 		    wait_return(TRUE);
 		    return FAIL;
 		}
@@ -1886,7 +1886,7 @@ set_termname(char_u *term)
 	    if (!termcap_cleared)
 	    {
 #endif
-		clear_termoptions();	    /* clear old options */
+		clear_termoptions();	    // clear old options
 #ifdef HAVE_TGETENT
 		termcap_cleared = TRUE;
 	    }
@@ -1897,15 +1897,15 @@ set_termname(char_u *term)
 	    {
 		out_flush();
 		gui_init();
-		/* If starting the GUI failed, don't do any of the other
-		 * things for this terminal */
+		// If starting the GUI failed, don't do any of the other
+		// things for this terminal
 		if (!gui.in_use)
 		    return FAIL;
 #ifdef HAVE_TGETENT
-		break;		/* don't try using external termcap */
+		break;		// don't try using external termcap
 #endif
 	    }
-#endif /* FEAT_GUI */
+#endif // FEAT_GUI
 	}
 #ifdef HAVE_TGETENT
     }
@@ -1976,7 +1976,7 @@ set_termname(char_u *term)
 	if (use_xterm_like_mouse(term))
 	{
 	    if (use_xterm_mouse())
-		p = NULL;	/* keep existing value, might be "xterm2" */
+		p = NULL;	// keep existing value, might be "xterm2"
 	    else
 		p = (char_u *)"xterm";
 	}
@@ -1984,8 +1984,8 @@ set_termname(char_u *term)
 	if (p != NULL)
 	{
 	    set_option_value((char_u *)"ttym", 0L, p, 0);
-	    /* Reset the WAS_SET flag, 'ttymouse' can be set to "sgr" or
-	     * "xterm2" in check_termcode(). */
+	    // Reset the WAS_SET flag, 'ttymouse' can be set to "sgr" or
+	    // "xterm2" in check_termcode().
 	    reset_option_was_set((char_u *)"ttym");
 	}
 	if (p == NULL
@@ -1993,21 +1993,21 @@ set_termname(char_u *term)
 		|| gui.in_use
 #  endif
 		)
-	    check_mouse_termcode();	/* set mouse termcode anyway */
+	    check_mouse_termcode();	// set mouse termcode anyway
     }
 #else
     set_mouse_termcode(KS_MOUSE, (char_u *)"\233M");
 #endif
 
 #ifdef USE_TERM_CONSOLE
-    /* DEFAULT_TERM indicates that it is the machine console. */
+    // DEFAULT_TERM indicates that it is the machine console.
     if (STRCMP(term, DEFAULT_TERM) != 0)
 	term_console = FALSE;
     else
     {
 	term_console = TRUE;
 # ifdef AMIGA
-	win_resize_on();	/* enable window resizing reports */
+	win_resize_on();	// enable window resizing reports
 # endif
     }
 #endif
@@ -2027,10 +2027,10 @@ set_termname(char_u *term)
 	p_tf = TRUE;
 #endif
 
-    ttest(TRUE);	/* make sure we have a valid set of terminal codes */
-
-    full_screen = TRUE;		/* we can use termcap codes from now on */
-    set_term_defaults();	/* use current values as defaults */
+    ttest(TRUE);	// make sure we have a valid set of terminal codes
+
+    full_screen = TRUE;		// we can use termcap codes from now on
+    set_term_defaults();	// use current values as defaults
 #ifdef FEAT_TERMRESPONSE
     LOG_TR(("setting crv_status to STATUS_GET"));
     crv_status.tr_progress = STATUS_GET;	// Get terminal version later
@@ -2044,31 +2044,31 @@ set_termname(char_u *term)
      */
     if (starting != NO_SCREEN)
     {
-	starttermcap();		/* may change terminal mode */
-	setmouse();		/* may start using the mouse */
+	starttermcap();		// may change terminal mode
+	setmouse();		// may start using the mouse
 #ifdef FEAT_TITLE
-	maketitle();		/* may display window title */
+	maketitle();		// may display window title
 #endif
     }
 
-	/* display initial screen after ttest() checking. jw. */
+	// display initial screen after ttest() checking. jw.
     if (width <= 0 || height <= 0)
     {
-	/* termcap failed to report size */
-	/* set defaults, in case ui_get_shellsize() also fails */
+	// termcap failed to report size
+	// set defaults, in case ui_get_shellsize() also fails
 	width = 80;
 #if defined(MSWIN)
-	height = 25;	    /* console is often 25 lines */
+	height = 25;	    // console is often 25 lines
 #else
-	height = 24;	    /* most terminals are 24 lines */
+	height = 24;	    // most terminals are 24 lines
 #endif
     }
-    set_shellsize(width, height, FALSE);	/* may change Rows */
+    set_shellsize(width, height, FALSE);	// may change Rows
     if (starting != NO_SCREEN)
     {
 	if (scroll_region)
-	    scroll_region_reset();		/* In case Rows changed */
-	check_map_keycodes();	/* check mappings for terminal codes used */
+	    scroll_region_reset();		// In case Rows changed
+	check_map_keycodes();	// check mappings for terminal codes used
 
 	{
 	    bufref_T	old_curbuf;
@@ -2107,15 +2107,15 @@ tgetent_error(char_u *tbuf, char_u *term
     int	    i;
 
     i = TGETENT(tbuf, term);
-    if (i < 0		    /* -1 is always an error */
+    if (i < 0		    // -1 is always an error
 # ifdef TGETENT_ZERO_ERR
-	    || i == 0	    /* sometimes zero is also an error */
+	    || i == 0	    // sometimes zero is also an error
 # endif
        )
     {
-	/* On FreeBSD tputs() gets a SEGV after a tgetent() which fails.  Call
-	 * tgetent() with the always existing "dumb" entry to avoid a crash or
-	 * hang. */
+	// On FreeBSD tputs() gets a SEGV after a tgetent() which fails.  Call
+	// tgetent() with the always existing "dumb" entry to avoid a crash or
+	// hang.
 	(void)TGETENT(tbuf, "dumb");
 
 	if (i < 0)
@@ -2146,7 +2146,7 @@ vim_tgetstr(char *s, char_u **pp)
 	p = NULL;
     return (char_u *)p;
 }
-#endif /* HAVE_TGETENT */
+#endif // HAVE_TGETENT
 
 #if defined(HAVE_TGETENT) && (defined(UNIX) || defined(VMS) || defined(MACOS_X))
 /*
@@ -2157,8 +2157,8 @@ vim_tgetstr(char *s, char_u **pp)
  */
     void
 getlinecol(
-    long	*cp,	/* pointer to columns */
-    long	*rp)	/* pointer to rows */
+    long	*cp,	// pointer to columns
+    long	*rp)	// pointer to rows
 {
     char_u	tbuf[TBUFSZ];
 
@@ -2170,7 +2170,7 @@ getlinecol(
 	    *rp = tgetnum("li");
     }
 }
-#endif /* defined(HAVE_TGETENT) && defined(UNIX) */
+#endif // defined(HAVE_TGETENT) && defined(UNIX)
 
 /*
  * Get a string entry from the termcap and add it to the list of termcodes.
@@ -2204,14 +2204,14 @@ add_termcap_entry(char_u *name, int forc
 	return gui_mch_haskey(name);
 #endif
 
-    if (!force && find_termcode(name) != NULL)	    /* it's already there */
+    if (!force && find_termcode(name) != NULL)	    // it's already there
 	return OK;
 
     term = T_NAME;
-    if (term == NULL || *term == NUL)	    /* 'term' not defined yet */
+    if (term == NULL || *term == NUL)	    // 'term' not defined yet
 	return FAIL;
 
-    if (term_is_builtin(term))		    /* name starts with "builtin_" */
+    if (term_is_builtin(term))		    // name starts with "builtin_"
     {
 	term += 8;
 #ifdef HAVE_TGETENT
@@ -2239,7 +2239,7 @@ add_termcap_entry(char_u *name, int forc
 	 */
 	{
 	    termp = find_builtin_term(term);
-	    if (termp->bt_string != NULL)	/* found it */
+	    if (termp->bt_string != NULL)	// found it
 	    {
 		key = TERMCAP2KEY(name[0], name[1]);
 		++termp;
@@ -2403,7 +2403,7 @@ tgoto(char *cm, int x, int y)
     return buf;
 }
 
-#endif /* HAVE_TGETENT */
+#endif // HAVE_TGETENT
 
 /*
  * Set the terminal name and initialize the terminal options.
@@ -2416,7 +2416,7 @@ termcapinit(char_u *name)
     char_u	*term;
 
     if (name != NULL && *name == NUL)
-	name = NULL;	    /* empty name is equal to no name */
+	name = NULL;	    // empty name is equal to no name
     term = name;
 
 #ifdef __BEOS__
@@ -2438,7 +2438,7 @@ termcapinit(char_u *name)
 	term = DEFAULT_TERM;
     set_string_option_direct((char_u *)"term", -1, term, OPT_FREE, 0);
 
-    /* Set the default terminal name. */
+    // Set the default terminal name.
     set_string_default("term", term);
     set_string_default("ttytype", term);
 
@@ -2472,7 +2472,7 @@ out_flush(void)
 
     if (out_pos != 0)
     {
-	/* set out_pos to 0 before ui_write, to avoid recursiveness */
+	// set out_pos to 0 before ui_write, to avoid recursiveness
 	len = out_pos;
 	out_pos = 0;
 	ui_write(out_buf, len);
@@ -2485,8 +2485,8 @@ out_flush(void)
  */
     void
 out_flush_cursor(
-    int	    force UNUSED,   /* when TRUE, update cursor even when not moved */
-    int	    clear_selection UNUSED) /* clear selection under cursor */
+    int	    force UNUSED,   // when TRUE, update cursor even when not moved
+    int	    clear_selection UNUSED) // clear selection under cursor
 {
     mch_disable_flush();
     out_flush();
@@ -2533,13 +2533,13 @@ out_trash(void)
 out_char(unsigned c)
 {
 #if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(MACOS_X)
-    if (c == '\n')	/* turn LF into CR-LF (CRMOD doesn't seem to do this) */
+    if (c == '\n')	// turn LF into CR-LF (CRMOD doesn't seem to do this)
 	out_char('\r');
 #endif
 
     out_buf[out_pos++] = c;
 
-    /* For testing we flush each time. */
+    // For testing we flush each time.
     if (out_pos >= OUT_SIZE || p_wd)
 	out_flush();
 }
@@ -2596,7 +2596,7 @@ out_str_cf(char_u *s)
 #endif
 
 #ifdef FEAT_GUI
-	/* Don't use tputs() when GUI is used, ncurses crashes. */
+	// Don't use tputs() when GUI is used, ncurses crashes.
 	if (gui.in_use)
 	{
 	    out_str_nf(s);
@@ -2608,7 +2608,7 @@ out_str_cf(char_u *s)
 #ifdef HAVE_TGETENT
 	for (p = s; *s; ++s)
 	{
-	    /* flush just before delay command */
+	    // flush just before delay command
 	    if (*s == '$' && *(s + 1) == '<')
 	    {
 		char_u save_c = *s;
@@ -2619,12 +2619,12 @@ out_str_cf(char_u *s)
 		*s = save_c;
 		out_flush();
 # ifdef ELAPSED_FUNC
-		/* Only sleep here if we can limit this happening in
-		 * vim_beep(). */
+		// Only sleep here if we can limit this happening in
+		// vim_beep().
 		p = vim_strchr(s, '>');
 		if (p == NULL || duration <= 0)
 		{
-		    /* can't parse the time, don't sleep here */
+		    // can't parse the time, don't sleep here
 		    p = s;
 		}
 		else
@@ -2633,7 +2633,7 @@ out_str_cf(char_u *s)
 		    do_sleep(duration);
 		}
 # else
-		/* Rely on the terminal library to sleep. */
+		// Rely on the terminal library to sleep.
 		p = s;
 # endif
 		break;
@@ -2645,7 +2645,7 @@ out_str_cf(char_u *s)
 	    out_char_nf(*s++);
 #endif
 
-	/* For testing we write one string at a time. */
+	// For testing we write one string at a time.
 	if (p_wd)
 	    out_flush();
     }
@@ -2663,14 +2663,14 @@ out_str(char_u *s)
     if (s != NULL && *s)
     {
 #ifdef FEAT_GUI
-	/* Don't use tputs() when GUI is used, ncurses crashes. */
+	// Don't use tputs() when GUI is used, ncurses crashes.
 	if (gui.in_use)
 	{
 	    out_str_nf(s);
 	    return;
 	}
 #endif
-	/* avoid terminal strings being split up */
+	// avoid terminal strings being split up
 	if (out_pos > OUT_SIZE - MAX_ESC_SEQ_LEN)
 	    out_flush();
 #ifdef HAVE_TGETENT
@@ -2680,7 +2680,7 @@ out_str(char_u *s)
 	    out_char_nf(*s++);
 #endif
 
-	/* For testing we write one string at a time. */
+	// For testing we write one string at a time.
 	if (p_wd)
 	    out_flush();
     }
@@ -2717,7 +2717,7 @@ term_delete_lines(int line_count)
     void
 term_set_winpos(int x, int y)
 {
-    /* Can't handle a negative value here */
+    // Can't handle a negative value here
     if (x < 0)
 	x = 0;
     if (y < 0)
@@ -2800,7 +2800,7 @@ term_get_winpos(int *x, int *y, varnumbe
     OUT_STR(T_CGP);
     out_flush();
 
-    /* Try reading the result for "timeout" msec. */
+    // Try reading the result for "timeout" msec.
     while (count++ <= timeout / 10 && !got_int)
     {
 	(void)vpeekc_nomap();
@@ -2812,14 +2812,14 @@ term_get_winpos(int *x, int *y, varnumbe
 	}
 	ui_delay(10L, FALSE);
     }
-    /* Do not reset "did_request_winpos", if we timed out the response might
-     * still come later and we must consume it. */
+    // Do not reset "did_request_winpos", if we timed out the response might
+    // still come later and we must consume it.
 
     winpos_x = prev_winpos_x;
     winpos_y = prev_winpos_y;
     if (timeout < 10 && prev_winpos_y >= 0 && prev_winpos_x >= 0)
     {
-	/* Polling: return previous values if we have them. */
+	// Polling: return previous values if we have them.
 	*x = winpos_x;
 	*y = winpos_y;
 	return OK;
@@ -2842,11 +2842,11 @@ term_color(char_u *s, int n)
 {
     char	buf[20];
     int		i = *s == CSI ? 1 : 2;
-		/* index in s[] just after <Esc>[ or CSI */
-
-    /* Special handling of 16 colors, because termcap can't handle it */
-    /* Also accept "\e[3%dm" for TERMINFO, it is sometimes used */
-    /* Also accept CSI instead of <Esc>[ */
+		// index in s[] just after <Esc>[ or CSI
+
+    // Special handling of 16 colors, because termcap can't handle it
+    // Also accept "\e[3%dm" for TERMINFO, it is sometimes used
+    // Also accept CSI instead of <Esc>[
     if (n >= 8 && t_colors >= 16
 	      && ((s[0] == ESC && s[1] == '[')
 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
@@ -2881,7 +2881,7 @@ term_color(char_u *s, int n)
     void
 term_fg_color(int n)
 {
-    /* Use "AF" termcap entry if present, "Sf" entry otherwise */
+    // Use "AF" termcap entry if present, "Sf" entry otherwise
     if (*T_CAF)
 	term_color(T_CAF, n);
     else if (*T_CSF)
@@ -2891,7 +2891,7 @@ term_fg_color(int n)
     void
 term_bg_color(int n)
 {
-    /* Use "AB" termcap entry if present, "Sb" entry otherwise */
+    // Use "AB" termcap entry if present, "Sb" entry otherwise
     if (*T_CAB)
 	term_color(T_CAB, n);
     else if (*T_CSB)
@@ -2914,7 +2914,7 @@ term_bg_color(int n)
 term_bg_default(void)
 {
 #if defined(MSWIN)
-    /* DOS console is nearly always black */
+    // DOS console is nearly always black
     return (char_u *)"dark";
 #else
     char_u	*p;
@@ -3026,7 +3026,7 @@ ttest(int pairs)
 {
     char_u *env_colors;
 
-    check_options();		    /* make sure no options are NULL */
+    check_options();		    // make sure no options are NULL
 
     /*
      * MUST have "cm": cursor motion.
@@ -3047,7 +3047,7 @@ ttest(int pairs)
 	/*
 	 * optional pairs
 	 */
-	/* TP goes to normal mode for TI (invert) and TB (bold) */
+	// TP goes to normal mode for TI (invert) and TB (bold)
 	if (*T_ME == NUL)
 	    T_ME = T_MR = T_MD = T_MB = empty_option;
 	if (*T_SO == NUL || *T_SE == NUL)
@@ -3057,11 +3057,11 @@ ttest(int pairs)
 	if (*T_CZH == NUL || *T_CZR == NUL)
 	    T_CZH = T_CZR = empty_option;
 
-	/* T_VE is needed even though T_VI is not defined */
+	// T_VE is needed even though T_VI is not defined
 	if (*T_VE == NUL)
 	    T_VI = empty_option;
 
-	/* if 'mr' or 'me' is not defined use 'so' and 'se' */
+	// if 'mr' or 'me' is not defined use 'so' and 'se'
 	if (*T_ME == NUL)
 	{
 	    T_ME = T_SE;
@@ -3069,7 +3069,7 @@ ttest(int pairs)
 	    T_MD = T_SO;
 	}
 
-	/* if 'so' or 'se' is not defined use 'mr' and 'me' */
+	// if 'so' or 'se' is not defined use 'mr' and 'me'
 	if (*T_SO == NUL)
 	{
 	    T_SE = T_ME;
@@ -3079,7 +3079,7 @@ ttest(int pairs)
 		T_SO = T_MR;
 	}
 
-	/* if 'ZH' or 'ZR' is not defined use 'mr' and 'me' */
+	// if 'ZH' or 'ZR' is not defined use 'mr' and 'me'
 	if (*T_CZH == NUL)
 	{
 	    T_CZR = T_ME;
@@ -3089,30 +3089,30 @@ ttest(int pairs)
 		T_CZH = T_MR;
 	}
 
-	/* "Sb" and "Sf" come in pairs */
+	// "Sb" and "Sf" come in pairs
 	if (*T_CSB == NUL || *T_CSF == NUL)
 	{
 	    T_CSB = empty_option;
 	    T_CSF = empty_option;
 	}
 
-	/* "AB" and "AF" come in pairs */
+	// "AB" and "AF" come in pairs
 	if (*T_CAB == NUL || *T_CAF == NUL)
 	{
 	    T_CAB = empty_option;
 	    T_CAF = empty_option;
 	}
 
-	/* if 'Sb' and 'AB' are not defined, reset "Co" */
+	// if 'Sb' and 'AB' are not defined, reset "Co"
 	if (*T_CSB == NUL && *T_CAB == NUL)
 	    free_one_termoption(T_CCO);
 
-	/* Set 'weirdinvert' according to value of 't_xs' */
+	// Set 'weirdinvert' according to value of 't_xs'
 	p_wiv = (*T_XS != NUL);
     }
     need_gather = TRUE;
 
-    /* Set t_colors to the value of $COLORS or t_Co. */
+    // Set t_colors to the value of $COLORS or t_Co.
     t_colors = atoi((char *)T_CCO);
     env_colors = mch_getenv((char_u *)"COLORS");
     if (env_colors != NULL && isdigit(*env_colors))
@@ -3192,19 +3192,19 @@ get_bytes_from_buf(char_u *buf, char_u *
 	    return -1;
 	if (c == K_SPECIAL)
 	{
-	    if (buf[len] == NUL || buf[len + 1] == NUL)	    /* cannot happen? */
+	    if (buf[len] == NUL || buf[len + 1] == NUL)	    // cannot happen?
 		return -1;
 	    if (buf[len++] == (int)KS_ZERO)
 		c = NUL;
-	    /* else it should be KS_SPECIAL; when followed by KE_FILLER c is
-	     * K_SPECIAL, or followed by KE_CSI and c must be CSI. */
+	    // else it should be KS_SPECIAL; when followed by KE_FILLER c is
+	    // K_SPECIAL, or followed by KE_CSI and c must be CSI.
 	    if (buf[len++] == (int)KE_CSI)
 		c = CSI;
 	}
 	else if (c == CSI && buf[len] == KS_EXTRA
 					       && buf[len + 1] == (int)KE_CSI)
-	    /* CSI is stored as CSI KS_SPECIAL KE_CSI to avoid confusion with
-	     * the start of a special key, see add_to_input_buf_csi(). */
+	    // CSI is stored as CSI KS_SPECIAL KE_CSI to avoid confusion with
+	    // the start of a special key, see add_to_input_buf_csi().
 	    len += 2;
 	bytes[i] = c;
     }
@@ -3218,7 +3218,7 @@ get_bytes_from_buf(char_u *buf, char_u *
     void
 check_shellsize(void)
 {
-    if (Rows < min_rows())	/* need room for one window and command line */
+    if (Rows < min_rows())	// need room for one window and command line
 	Rows = min_rows();
     limit_screen_size();
 }
@@ -3250,16 +3250,16 @@ win_new_shellsize(void)
 	ui_new_shellsize();
     if (old_Rows != Rows)
     {
-	/* if 'window' uses the whole screen, keep it using that */
+	// if 'window' uses the whole screen, keep it using that
 	if (p_window == old_Rows - 1 || old_Rows == 0)
 	    p_window = Rows - 1;
 	old_Rows = Rows;
-	shell_new_rows();	/* update window sizes */
+	shell_new_rows();	// update window sizes
     }
     if (old_Columns != Columns)
     {
 	old_Columns = Columns;
-	shell_new_columns();	/* update window sizes */
+	shell_new_columns();	// update window sizes
     }
 }
 
@@ -3285,8 +3285,8 @@ shell_resized_check(void)
 
     if (!exiting
 #ifdef FEAT_GUI
-	    /* Do not get the size when executing a shell command during
-	     * startup. */
+	    // Do not get the size when executing a shell command during
+	    // startup.
 	    && !gui.starting
 #endif
 	    )
@@ -3317,7 +3317,7 @@ set_shellsize(int width, int height, int
     if (busy)
 	return;
 
-    if (width < 0 || height < 0)    /* just checking... */
+    if (width < 0 || height < 0)    // just checking...
 	return;
 
     if (State == HITRETURN || State == SETWSIZE)
@@ -3331,18 +3331,17 @@ set_shellsize(int width, int height, int
 	// resizing while in update_screen() may cause a crash
 	return;
 
-    /* curwin->w_buffer can be NULL when we are closing a window and the
-     * buffer has already been closed and removing a scrollbar causes a resize
-     * event. Don't resize then, it will happen after entering another buffer.
-     */
+    // curwin->w_buffer can be NULL when we are closing a window and the
+    // buffer has already been closed and removing a scrollbar causes a resize
+    // event. Don't resize then, it will happen after entering another buffer.
     if (curwin->w_buffer == NULL)
 	return;
 
     ++busy;
 
 #ifdef AMIGA
-    out_flush();	    /* must do this before mch_get_shellsize() for
-			       some obscure reason */
+    out_flush();	    // must do this before mch_get_shellsize() for
+			    // some obscure reason
 #endif
 
     if (mustset || (ui_get_shellsize() == FAIL && height != 0))
@@ -3355,14 +3354,14 @@ set_shellsize(int width, int height, int
     else
 	check_shellsize();
 
-    /* The window layout used to be adjusted here, but it now happens in
-     * screenalloc() (also invoked from screenclear()).  That is because the
-     * "busy" check above may skip this, but not screenalloc(). */
+    // The window layout used to be adjusted here, but it now happens in
+    // screenalloc() (also invoked from screenclear()).  That is because the
+    // "busy" check above may skip this, but not screenalloc().
 
     if (State != ASKMORE && State != EXTERNCMD && State != CONFIRM)
 	screenclear();
     else
-	screen_start();	    /* don't know where cursor is now */
+	screen_start();	    // don't know where cursor is now
 
     if (starting != NO_SCREEN)
     {
@@ -3410,7 +3409,7 @@ set_shellsize(int width, int height, int
 		    setcursor();
 	    }
 	}
-	cursor_on();	    /* redrawing may have switched it off */
+	cursor_on();	    // redrawing may have switched it off
     }
     out_flush();
     --busy;
@@ -3424,7 +3423,7 @@ set_shellsize(int width, int height, int
 settmode(int tmode)
 {
 #ifdef FEAT_GUI
-    /* don't set the term where gvim was started to any mode */
+    // don't set the term where gvim was started to any mode
     if (gui.in_use)
 	return;
 #endif
@@ -3482,21 +3481,21 @@ starttermcap(void)
 {
     if (full_screen && !termcap_active)
     {
-	out_str(T_TI);			/* start termcap mode */
-	out_str(T_CTI);			/* start "raw" mode */
-	out_str(T_KS);			/* start "keypad transmit" mode */
-	out_str(T_BE);			/* enable bracketed paste mode */
+	out_str(T_TI);			// start termcap mode
+	out_str(T_CTI);			// start "raw" mode
+	out_str(T_KS);			// start "keypad transmit" mode
+	out_str(T_BE);			// enable bracketed paste mode
 	out_flush();
 	termcap_active = TRUE;
-	screen_start();			/* don't know where cursor is now */
+	screen_start();			// don't know where cursor is now
 #ifdef FEAT_TERMRESPONSE
 # ifdef FEAT_GUI
 	if (!gui.in_use && !gui.starting)
 # endif
 	{
 	    may_req_termresponse();
-	    /* Immediately check for a response.  If t_Co changes, we don't
-	     * want to redraw with wrong colors first. */
+	    // Immediately check for a response.  If t_Co changes, we don't
+	    // want to redraw with wrong colors first.
 	    if (crv_status.tr_progress == STATUS_SENT)
 		check_for_codes_from_term();
 	}
@@ -3529,19 +3528,19 @@ stoptermcap(void)
 		    tcflush(fileno(stdin), TCIFLUSH);
 # endif
 	    }
-	    /* Check for termcodes first, otherwise an external program may
-	     * get them. */
+	    // Check for termcodes first, otherwise an external program may
+	    // get them.
 	    check_for_codes_from_term();
 	}
 #endif
-	out_str(T_BD);			/* disable bracketed paste mode */
-	out_str(T_KE);			/* stop "keypad transmit" mode */
+	out_str(T_BD);			// disable bracketed paste mode
+	out_str(T_KE);			// stop "keypad transmit" mode
 	out_flush();
 	termcap_active = FALSE;
-	cursor_on();			/* just in case it is still off */
-	out_str(T_CTE);			/* stop "raw" mode */
-	out_str(T_TE);			/* stop termcap mode */
-	screen_start();			/* don't know where cursor is now */
+	cursor_on();			// just in case it is still off
+	out_str(T_CTE);			// stop "raw" mode
+	out_str(T_TE);			// stop termcap mode
+	screen_start();			// don't know where cursor is now
 	out_flush();
     }
 }
@@ -3572,8 +3571,8 @@ may_req_termresponse(void)
 	LOG_TR(("Sending CRV request"));
 	out_str(T_CRV);
 	termrequest_sent(&crv_status);
-	/* check for the characters now, otherwise they might be eaten by
-	 * get_keystroke() */
+	// check for the characters now, otherwise they might be eaten by
+	// get_keystroke()
 	out_flush();
 	(void)vpeekc_nomap();
     }
@@ -3600,8 +3599,8 @@ may_req_ambiguous_char_width(void)
 	char_u	buf[16];
 
 	LOG_TR(("Sending U7 request"));
-	/* Do this in the second row.  In the first row the returned sequence
-	 * may be CSI 1;2R, which is the same as <S-F3>. */
+	// Do this in the second row.  In the first row the returned sequence
+	// may be CSI 1;2R, which is the same as <S-F3>.
 	term_windgoto(1, 0);
 	buf[mb_char2bytes(0x25bd, buf)] = 0;
 	out_str(buf);
@@ -3609,18 +3608,18 @@ may_req_ambiguous_char_width(void)
 	termrequest_sent(&u7_status);
 	out_flush();
 
-	/* This overwrites a few characters on the screen, a redraw is needed
-	 * after this. Clear them out for now. */
+	// This overwrites a few characters on the screen, a redraw is needed
+	// after this. Clear them out for now.
 	screen_stop_highlight();
 	term_windgoto(1, 0);
 	out_str((char_u *)"  ");
 	term_windgoto(0, 0);
 
-	/* Need to reset the known cursor position. */
+	// Need to reset the known cursor position.
 	screen_start();
 
-	/* check for the characters now, otherwise they might be eaten by
-	 * get_keystroke() */
+	// check for the characters now, otherwise they might be eaten by
+	// get_keystroke()
 	out_flush();
 	(void)vpeekc_nomap();
     }
@@ -3638,7 +3637,7 @@ may_req_bg_color(void)
 	int didit = FALSE;
 
 # ifdef FEAT_TERMINAL
-	/* Only request foreground if t_RF is set. */
+	// Only request foreground if t_RF is set.
 	if (rfg_status.tr_progress == STATUS_GET && *T_RFG != NUL)
 	{
 	    LOG_TR(("Sending FG request"));
@@ -3648,7 +3647,7 @@ may_req_bg_color(void)
 	}
 # endif
 
-	/* Only request background if t_RB is set. */
+	// Only request background if t_RB is set.
 	if (rbg_status.tr_progress == STATUS_GET && *T_RBG != NUL)
 	{
 	    LOG_TR(("Sending BG request"));
@@ -3659,8 +3658,8 @@ may_req_bg_color(void)
 
 	if (didit)
 	{
-	    /* check for the characters now, otherwise they might be eaten by
-	     * get_keystroke() */
+	    // check for the characters now, otherwise they might be eaten by
+	    // get_keystroke()
 	    out_flush();
 	    (void)vpeekc_nomap();
 	}
@@ -3716,7 +3715,7 @@ scroll_start(void)
     {
 	out_str(T_VS);
 	out_str(T_CVS);
-	screen_start();		/* don't know where cursor is now */
+	screen_start();		// don't know where cursor is now
     }
 }
 
@@ -3750,7 +3749,7 @@ cursor_off(void)
 {
     if (full_screen && !cursor_is_off)
     {
-	out_str(T_VI);	    /* disable cursor */
+	out_str(T_VI);	    // disable cursor
 	cursor_is_off = TRUE;
     }
 }
@@ -3765,13 +3764,13 @@ term_cursor_mode(int forced)
     static int showing_mode = -1;
     char_u *p;
 
-    /* Only do something when redrawing the screen and we can restore the
-     * mode. */
+    // Only do something when redrawing the screen and we can restore the
+    // mode.
     if (!full_screen || *T_CEI == NUL)
     {
 # ifdef FEAT_TERMRESPONSE
 	if (forced && initial_cursor_shape > 0)
-	    /* Restore to initial values. */
+	    // Restore to initial values.
 	    term_cursor_shape(initial_cursor_shape, initial_cursor_blink);
 # endif
 	return;
@@ -3782,9 +3781,9 @@ term_cursor_mode(int forced)
 	if (forced || showing_mode != REPLACE)
 	{
 	    if (*T_CSR != NUL)
-		p = T_CSR;	/* Replace mode cursor */
+		p = T_CSR;	// Replace mode cursor
 	    else
-		p = T_CSI;	/* fall back to Insert mode cursor */
+		p = T_CSI;	// fall back to Insert mode cursor
 	    if (*p != NUL)
 	    {
 		out_str(p);
@@ -3796,13 +3795,13 @@ term_cursor_mode(int forced)
     {
 	if ((forced || showing_mode != INSERT) && *T_CSI != NUL)
 	{
-	    out_str(T_CSI);	    /* Insert mode cursor */
+	    out_str(T_CSI);	    // Insert mode cursor
 	    showing_mode = INSERT;
 	}
     }
     else if (forced || showing_mode != NORMAL)
     {
-	out_str(T_CEI);		    /* non-Insert mode cursor */
+	out_str(T_CEI);		    // non-Insert mode cursor
 	showing_mode = NORMAL;
     }
 }
@@ -3848,9 +3847,9 @@ term_cursor_shape(int shape, int blink)
     {
 	int do_blink = blink;
 
-	/* t_SH is empty: try setting just the blink state.
-	 * The blink flags are XORed together, if the initial blinking from
-	 * style and shape differs, we need to invert the flag here. */
+	// t_SH is empty: try setting just the blink state.
+	// The blink flags are XORed together, if the initial blinking from
+	// style and shape differs, we need to invert the flag here.
 	if (blink_state_is_inverted())
 	    do_blink = !blink;
 
@@ -3882,7 +3881,7 @@ scroll_region_set(win_T *wp, int off)
     if (*T_CSV != NUL && wp->w_width != Columns)
 	OUT_STR(tgoto((char *)T_CSV, wp->w_wincol + wp->w_width - 1,
 							       wp->w_wincol));
-    screen_start();		    /* don't know where cursor is now */
+    screen_start();		    // don't know where cursor is now
 }
 
 /*
@@ -3894,7 +3893,7 @@ scroll_region_reset(void)
     OUT_STR(tgoto((char *)T_CS, (int)Rows - 1, 0));
     if (*T_CSV != NUL)
 	OUT_STR(tgoto((char *)T_CSV, (int)Columns - 1, 0));
-    screen_start();		    /* don't know where cursor is now */
+    screen_start();		    // don't know where cursor is now
 }
 
 
@@ -3904,14 +3903,14 @@ scroll_region_reset(void)
 
 static struct termcode
 {
-    char_u  name[2];	    /* termcap name of entry */
-    char_u  *code;	    /* terminal code (in allocated memory) */
-    int	    len;	    /* STRLEN(code) */
-    int	    modlen;	    /* length of part before ";*~". */
+    char_u  name[2];	    // termcap name of entry
+    char_u  *code;	    // terminal code (in allocated memory)
+    int	    len;	    // STRLEN(code)
+    int	    modlen;	    // length of part before ";*~".
 } *termcodes = NULL;
 
-static int  tc_max_len = 0; /* number of entries that termcodes[] can hold */
-static int  tc_len = 0;	    /* current number of entries in termcodes[] */
+static int  tc_max_len = 0; // number of entries that termcodes[] can hold
+static int  tc_len = 0;	    // current number of entries in termcodes[]
 
 static int termcode_star(char_u *code, int len);
 
@@ -3926,11 +3925,11 @@ clear_termcodes(void)
 #ifdef HAVE_TGETENT
     BC = (char *)empty_option;
     UP = (char *)empty_option;
-    PC = NUL;			/* set pad character to NUL */
+    PC = NUL;			// set pad character to NUL
     ospeed = 0;
 #endif
 
-    need_gather = TRUE;		/* need to fill termleader[] */
+    need_gather = TRUE;		// need to fill termleader[]
 }
 
 #define ATC_FROM_TERM 55
@@ -3968,7 +3967,7 @@ add_termcode(char_u *name, char_u *strin
     if (s == NULL)
 	return;
 
-    /* Change leading <Esc>[ to CSI, change <Esc>O to <M-O>. */
+    // Change leading <Esc>[ to CSI, change <Esc>O to <M-O>.
     if (flags != 0 && flags != ATC_FROM_TERM && term_7to8bit(string) != 0)
     {
 	STRMOVE(s, s + 1);
@@ -3990,7 +3989,7 @@ add_termcode(char_u *name, char_u *strin
 
     len = (int)STRLEN(s);
 
-    need_gather = TRUE;		/* need to fill termleader[] */
+    need_gather = TRUE;		// need to fill termleader[]
 
     /*
      * need to make space for more entries
@@ -4031,21 +4030,21 @@ add_termcode(char_u *name, char_u *strin
 		if (flags == ATC_FROM_TERM && (j = termcode_star(
 				    termcodes[i].code, termcodes[i].len)) > 0)
 		{
-		    /* Don't replace ESC[123;*X or ESC O*X with another when
-		     * invoked from got_code_from_term(). */
+		    // Don't replace ESC[123;*X or ESC O*X with another when
+		    // invoked from got_code_from_term().
 		    if (len == termcodes[i].len - j
 			    && STRNCMP(s, termcodes[i].code, len - 1) == 0
 			    && s[len - 1]
 				   == termcodes[i].code[termcodes[i].len - 1])
 		    {
-			/* They are equal but for the ";*": don't add it. */
+			// They are equal but for the ";*": don't add it.
 			vim_free(s);
 			return;
 		    }
 		}
 		else
 		{
-		    /* Replace old code. */
+		    // Replace old code.
 		    vim_free(termcodes[i].code);
 		    --tc_len;
 		    break;
@@ -4065,8 +4064,8 @@ add_termcode(char_u *name, char_u *strin
     termcodes[i].code = s;
     termcodes[i].len = len;
 
-    /* For xterm we recognize special codes like "ESC[42;*X" and "ESC O*X" that
-     * accept modifiers. */
+    // For xterm we recognize special codes like "ESC[42;*X" and "ESC O*X" that
+    // accept modifiers.
     termcodes[i].modlen = 0;
     j = termcode_star(s, len);
     if (j > 0)
@@ -4082,7 +4081,7 @@ add_termcode(char_u *name, char_u *strin
     static int
 termcode_star(char_u *code, int len)
 {
-    /* Shortest is <M-O>*X.  With ; shortest is <CSI>1;*X */
+    // Shortest is <M-O>*X.  With ; shortest is <CSI>1;*X
     if (len >= 3 && code[len - 2] == '*')
     {
 	if (len >= 5 && code[len - 3] == ';')
@@ -4126,10 +4125,10 @@ del_termcode(char_u *name)
 {
     int	    i;
 
-    if (termcodes == NULL)	/* nothing there yet */
+    if (termcodes == NULL)	// nothing there yet
 	return;
 
-    need_gather = TRUE;		/* need to fill termleader[] */
+    need_gather = TRUE;		// need to fill termleader[]
 
     for (i = 0; i < tc_len; ++i)
 	if (termcodes[i].name[0] == name[0] && termcodes[i].name[1] == name[1])
@@ -4137,7 +4136,7 @@ del_termcode(char_u *name)
 	    del_termcode_idx(i);
 	    return;
 	}
-    /* not found. Give error message? */
+    // not found. Give error message?
 }
 
     static void
@@ -4162,7 +4161,7 @@ switch_to_8bit(void)
     int		i;
     int		c;
 
-    /* Only need to do something when not already using 8-bit codes. */
+    // Only need to do something when not already using 8-bit codes.
     if (!term_is_8bit(T_NAME))
     {
 	for (i = 0; i < tc_len; ++i)
@@ -4174,7 +4173,7 @@ switch_to_8bit(void)
 		termcodes[i].code[0] = c;
 	    }
 	}
-	need_gather = TRUE;		/* need to fill termleader[] */
+	need_gather = TRUE;		// need to fill termleader[]
     }
     detected_8bit = TRUE;
     LOG_TR(("Switching to 8 bit"));
@@ -4336,7 +4335,7 @@ check_termcode(
 {
     char_u	*tp;
     char_u	*p;
-    int		slen = 0;	/* init for GCC */
+    int		slen = 0;	// init for GCC
     int		modslen;
     int		len;
     int		retval = 0;
@@ -4374,7 +4373,7 @@ check_termcode(
 	    if (offset >= typebuf.tb_len)
 		break;
 	    tp = typebuf.tb_buf + typebuf.tb_off + offset;
-	    len = typebuf.tb_len - offset;	/* length of the input */
+	    len = typebuf.tb_len - offset;	// length of the input
 	}
 	else
 	{
@@ -4390,7 +4389,7 @@ check_termcode(
 	 */
 	if (*tp == K_SPECIAL)
 	{
-	    offset += 2;	/* there are always 2 extra characters */
+	    offset += 2;	// there are always 2 extra characters
 	    continue;
 	}
 
@@ -4412,9 +4411,9 @@ check_termcode(
 	if (*tp == ESC && !p_ek && (State & INSERT))
 	    continue;
 
-	key_name[0] = NUL;	/* no key name found yet */
-	key_name[1] = NUL;	/* no key name found yet */
-	modifiers = 0;		/* no modifiers yet */
+	key_name[0] = NUL;	// no key name found yet
+	key_name[1] = NUL;	// no key name found yet
+	modifiers = 0;		// no modifiers yet
 
 #ifdef FEAT_GUI
 	if (gui.in_use)
@@ -4422,17 +4421,17 @@ check_termcode(
 	    /*
 	     * GUI special key codes are all of the form [CSI xx].
 	     */
-	    if (*tp == CSI)	    /* Special key from GUI */
+	    if (*tp == CSI)	    // Special key from GUI
 	    {
 		if (len < 3)
-		    return -1;	    /* Shouldn't happen */
+		    return -1;	    // Shouldn't happen
 		slen = 3;
 		key_name[0] = tp[1];
 		key_name[1] = tp[2];
 	    }
 	}
 	else
-#endif /* FEAT_GUI */
+#endif // FEAT_GUI
 	{
 	    for (idx = 0; idx < tc_len; ++idx)
 	    {
@@ -4449,8 +4448,8 @@ check_termcode(
 		if (STRNCMP(termcodes[idx].code, tp,
 				     (size_t)(slen > len ? len : slen)) == 0)
 		{
-		    if (len < slen)		/* got a partial sequence */
-			return -1;		/* need to get more chars */
+		    if (len < slen)		// got a partial sequence
+			return -1;		// need to get more chars
 
 		    /*
 		     * When found a keypad key, check if there is another key
@@ -4493,13 +4492,13 @@ check_termcode(
 		    {
 			int	    n;
 
-			if (len <= modslen)	/* got a partial sequence */
-			    return -1;		/* need to get more chars */
+			if (len <= modslen)	// got a partial sequence
+			    return -1;		// need to get more chars
 
 			if (tp[modslen] == termcodes[idx].code[slen - 1])
-			    slen = modslen + 1;	/* no modifiers */
+			    slen = modslen + 1;	// no modifiers
 			else if (tp[modslen] != ';' && modslen == slen - 3)
-			    continue;	/* no match */
+			    continue;	// no match
 			else
 			{
 			    // Skip over the digits, the final char must
@@ -4509,10 +4508,10 @@ check_termcode(
 				       || tp[j] == '-' || tp[j] == ';'); ++j)
 				;
 			    ++j;
-			    if (len < j)	/* got a partial sequence */
-				return -1;	/* need to get more chars */
+			    if (len < j)	// got a partial sequence
+				return -1;	// need to get more chars
 			    if (tp[j - 1] != termcodes[idx].code[slen - 1])
-				continue;	/* no match */
+				continue;	// no match
 
 			    modifiers_start = tp + slen - 2;
 
@@ -4532,9 +4531,9 @@ check_termcode(
 
 #ifdef FEAT_TERMRESPONSE
 	if (key_name[0] == NUL
-	    /* Mouse codes of DEC and pterm start with <ESC>[.  When
-	     * detecting the start of these mouse codes they might as well be
-	     * another key code or terminal response. */
+	    // Mouse codes of DEC and pterm start with <ESC>[.  When
+	    // detecting the start of these mouse codes they might as well be
+	    // another key code or terminal response.
 # ifdef FEAT_MOUSE_DEC
 	    || key_name[0] == KS_DEC_MOUSE
 # endif
@@ -4714,7 +4713,7 @@ not_enough:
 			    // 256, libvterm supports even more.
 			    if (mch_getenv((char_u *)"COLORS") == NULL)
 				may_adjust_color_count(256);
-			    /* Libvterm can handle SGR mouse reporting. */
+			    // Libvterm can handle SGR mouse reporting.
 			    if (!option_was_set((char_u *)"ttym"))
 				set_option_value((char_u *)"ttym", 0L,
 							   (char_u *)"sgr", 0);
@@ -4915,18 +4914,17 @@ not_enough:
 		// user can't create a map for it.
 	    }
 
-	    /* Check for fore/background color response from the terminal:
-	     *
-	     *       {lead}{code};rgb:{rrrr}/{gggg}/{bbbb}{tail}
-	     * or    {lead}{code};rgb:{rr}/{gg}/{bb}{tail}
-	     *
-	     * {code} is 10 for foreground, 11 for background
-	     * {lead} can be <Esc>] or OSC
-	     * {tail} can be '\007', <Esc>\ or STERM.
-	     *
-	     * Consume any code that starts with "{lead}11;", it's also
-	     * possible that "rgba" is following.
-	     */
+	    // Check for fore/background color response from the terminal:
+	    //
+	    //       {lead}{code};rgb:{rrrr}/{gggg}/{bbbb}{tail}
+	    // or    {lead}{code};rgb:{rr}/{gg}/{bb}{tail}
+	    //
+	    // {code} is 10 for foreground, 11 for background
+	    // {lead} can be <Esc>] or OSC
+	    // {tail} can be '\007', <Esc>\ or STERM.
+	    //
+	    // Consume any code that starts with "{lead}11;", it's also
+	    // possible that "rgba" is following.
 	    else if ((*T_RBG != NUL || *T_RFG != NUL)
 			&& ((tp[0] == ESC && len >= 2 && tp[1] == ']')
 			    || tp[0] == OSC))
@@ -4935,7 +4933,7 @@ not_enough:
 		if (len >= j + 3 && (argp[0] != '1'
 					 || (argp[1] != '1' && argp[1] != '0')
 					 || argp[2] != ';'))
-		  i = 0; /* no match */
+		  i = 0; // no match
 		else
 		  for (i = j; i < len; ++i)
 		    if (tp[i] == '\007' || (tp[0] == OSC ? tp[i] == STERM
@@ -4974,7 +4972,7 @@ not_enough:
 				if (!option_was_set((char_u *)"bg")
 					      && STRCMP(p_bg, new_bg_val) != 0)
 				{
-				    /* value differs, apply it */
+				    // value differs, apply it
 				    set_option_value((char_u *)"bg", 0L,
 						      (char_u *)new_bg_val, 0);
 				    reset_option_was_set((char_u *)"bg");
@@ -4993,7 +4991,7 @@ not_enough:
 # endif
 			}
 
-			/* got finished code: consume it */
+			// got finished code: consume it
 			key_name[0] = (int)KS_EXTRA;
 			key_name[1] = (int)KE_IGNORE;
 			slen = i + 1 + (tp[i] == ESC);
@@ -5010,21 +5008,20 @@ not_enough:
 		}
 	    }
 
-	    /* Check for key code response from xterm:
-	     * {lead}{flag}+r<hex bytes><{tail}
-	     *
-	     * {lead} can be <Esc>P or DCS
-	     * {flag} can be '0' or '1'
-	     * {tail} can be Esc>\ or STERM
-	     *
-	     * Check for cursor shape response from xterm:
-	     * {lead}1$r<digit> q{tail}
-	     *
-	     * {lead} can be <Esc>P or DCS
-	     * {tail} can be <Esc>\ or STERM
-	     *
-	     * Consume any code that starts with "{lead}.+r" or "{lead}.$r".
-	     */
+	    // Check for key code response from xterm:
+	    // {lead}{flag}+r<hex bytes><{tail}
+	    //
+	    // {lead} can be <Esc>P or DCS
+	    // {flag} can be '0' or '1'
+	    // {tail} can be Esc>\ or STERM
+	    //
+	    // Check for cursor shape response from xterm:
+	    // {lead}1$r<digit> q{tail}
+	    //
+	    // {lead} can be <Esc>P or DCS
+	    // {tail} can be <Esc>\ or STERM
+	    //
+	    // Consume any code that starts with "{lead}.+r" or "{lead}.$r".
 	    else if ((check_for_codes || rcs_status.tr_progress == STATUS_SENT)
 		    && ((tp[0] == ESC && len >= 2 && tp[1] == 'P')
 			|| tp[0] == DCS))
@@ -5094,8 +5091,8 @@ not_enough:
 
 		if (i == len)
 		{
-		    /* These codes arrive many together, each code can be
-		     * truncated at any point. */
+		    // These codes arrive many together, each code can be
+		    // truncated at any point.
 		    LOG_TR(("not enough characters for XT"));
 		    return -1;
 		}
@@ -5104,9 +5101,9 @@ not_enough:
 #endif
 
 	if (key_name[0] == NUL)
-	    continue;	    /* No match at this position, try next one */
-
-	/* We only get here when we have a complete termcode match */
+	    continue;	    // No match at this position, try next one
+
+	// We only get here when we have a complete termcode match
 
 #ifdef FEAT_GUI
 	/*
@@ -5193,8 +5190,8 @@ not_enough:
 	    current_menu = (vimmenu_T *)val;
 	    slen += num_bytes;
 
-	    /* The menu may have been deleted right after it was used, check
-	     * for that. */
+	    // The menu may have been deleted right after it was used, check
+	    // for that.
 	    if (check_menu_pointer(root_menu, current_menu) == FAIL)
 	    {
 		key_name[0] = KS_EXTRA;
@@ -5212,7 +5209,7 @@ not_enough:
 	    if (num_bytes == -1)
 		return -1;
 	    current_tab = (int)bytes[0];
-	    if (current_tab == 255)	/* -1 in a byte gives 255 */
+	    if (current_tab == 255)	// -1 in a byte gives 255
 		current_tab = -1;
 	    slen += num_bytes;
 	}
@@ -5236,7 +5233,7 @@ not_enough:
 	    char_u	bytes[6];
 	    int		num_bytes;
 
-	    /* Get the last scrollbar event in the queue of the same type */
+	    // Get the last scrollbar event in the queue of the same type
 	    j = 0;
 	    for (i = 0; tp[j] == CSI && tp[j + 1] == KS_VER_SCROLLBAR
 						     && tp[j + 2] != NUL; ++i)
@@ -5257,7 +5254,7 @@ not_enough:
 		j += num_bytes;
 		slen = j;
 	    }
-	    if (i == 0)		/* not enough characters to make one */
+	    if (i == 0)		// not enough characters to make one
 		return -1;
 	}
 	else if (key_name[0] == (int)KS_HOR_SCROLLBAR)
@@ -5265,7 +5262,7 @@ not_enough:
 	    long_u	val;
 	    int		num_bytes;
 
-	    /* Get the last horiz. scrollbar event in the queue */
+	    // Get the last horiz. scrollbar event in the queue
 	    j = 0;
 	    for (i = 0; tp[j] == CSI && tp[j + 1] == KS_HOR_SCROLLBAR
 						     && tp[j + 2] != NUL; ++i)
@@ -5278,11 +5275,11 @@ not_enough:
 		j += num_bytes;
 		slen = j;
 	    }
-	    if (i == 0)		/* not enough characters to make one */
+	    if (i == 0)		// not enough characters to make one
 		return -1;
 	}
-# endif /* !USE_ON_FLY_SCROLL */
-#endif /* FEAT_GUI */
+# endif // !USE_ON_FLY_SCROLL
+#endif // FEAT_GUI
 
 	/*
 	 * Change <xHome> to <Home>, <xUp> to <Up>, etc.
@@ -5294,12 +5291,12 @@ not_enough:
 	 */
 	new_slen = modifiers2keycode(modifiers, &key, string);
 
-	/* Finally, add the special key code to our string */
+	// Finally, add the special key code to our string
 	key_name[0] = KEY2TERMCAP0(key);
 	key_name[1] = KEY2TERMCAP1(key);
 	if (key_name[0] == KS_KEY)
 	{
-	    /* from ":set <M-b>=xx" */
+	    // from ":set <M-b>=xx"
 	    if (has_mbyte)
 		new_slen += (*mb_char2bytes)(key_name[1], string + new_slen);
 	    else
@@ -5308,8 +5305,8 @@ not_enough:
 	else if (new_slen == 0 && key_name[0] == KS_EXTRA
 						  && key_name[1] == KE_IGNORE)
 	{
-	    /* Do not put K_IGNORE into the buffer, do return KEYLEN_REMOVED
-	     * to indicate what happened. */
+	    // Do not put K_IGNORE into the buffer, do return KEYLEN_REMOVED
+	    // to indicate what happened.
 	    retval = KEYLEN_REMOVED;
 	}
 	else
@@ -5328,7 +5325,7 @@ not_enough:
     LOG_TR(("normal character"));
 #endif
 
-    return 0;			    /* no match found */
+    return 0;			    // no match found
 }
 
 #if (defined(FEAT_TERMINAL) && defined(FEAT_TERMRESPONSE)) || defined(PROTO)
@@ -5400,10 +5397,10 @@ replace_termcodes(
     int		key;
     int		dlen = 0;
     char_u	*src;
-    int		do_backslash;	/* backslash is a special character */
-    int		do_special;	/* recognize <> key codes */
-    int		do_key_code;	/* recognize raw key codes */
-    char_u	*result;	/* buffer for resulting string */
+    int		do_backslash;	// backslash is a special character
+    int		do_special;	// recognize <> key codes
+    int		do_key_code;	// recognize raw key codes
+    char_u	*result;	// buffer for resulting string
 
     do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL);
     do_special = (vim_strchr(p_cpo, CPO_SPECI) == NULL)
@@ -5415,7 +5412,7 @@ replace_termcodes(
      * replaced by 6 bytes (shifted special key), plus a NUL at the end.
      */
     result = alloc(STRLEN(from) * 6 + 1);
-    if (result == NULL)		/* out of memory */
+    if (result == NULL)		// out of memory
     {
 	*bufp = NULL;
 	return from;
@@ -5431,9 +5428,9 @@ replace_termcodes(
 	result[dlen++] = K_SPECIAL;
 	result[dlen++] = 'k';
 	if (src[1] == '0')
-	    result[dlen++] = ';';	/* #0 is F10 is "k;" */
+	    result[dlen++] = ';';	// #0 is F10 is "k;"
 	else
-	    result[dlen++] = src[1];	/* #3 is F3 is "k3" */
+	    result[dlen++] = src[1];	// #3 is F3 is "k3"
 	src += 2;
     }
 
@@ -5497,7 +5494,7 @@ replace_termcodes(
 		result[dlen++] = termcodes[i].name[0];
 		result[dlen++] = termcodes[i].name[1];
 		src += termcodes[i].len;
-		/* If terminal code matched, continue after it. */
+		// If terminal code matched, continue after it.
 		continue;
 	    }
 	}
@@ -5529,7 +5526,7 @@ replace_termcodes(
 	    }
 	    if (len != 0)
 	    {
-		/* Allow up to 8 * 6 characters for "mapleader". */
+		// Allow up to 8 * 6 characters for "mapleader".
 		if (p == NULL || *p == NUL || STRLEN(p) > 8 * 6)
 		    s = (char_u *)"\\";
 		else
@@ -5551,7 +5548,7 @@ replace_termcodes(
 	key = *src;
 	if (key == Ctrl_V || (do_backslash && key == '\\'))
 	{
-	    ++src;				/* skip CTRL-V or backslash */
+	    ++src;				// skip CTRL-V or backslash
 	    if (*src == NUL)
 	    {
 		if (flags & REPTERM_FROM_PART)
@@ -5560,7 +5557,7 @@ replace_termcodes(
 	    }
 	}
 
-	/* skip multibyte char correctly */
+	// skip multibyte char correctly
 	for (i = (*mb_ptr2len)(src); i > 0; --i)
 	{
 	    /*
@@ -5630,12 +5627,12 @@ gather_termleader(void)
 
 #ifdef FEAT_GUI
     if (gui.in_use)
-	termleader[len++] = CSI;    /* the GUI codes are not in termcodes[] */
+	termleader[len++] = CSI;    // the GUI codes are not in termcodes[]
 #endif
 #ifdef FEAT_TERMRESPONSE
     if (check_for_codes || *T_CRS != NUL)
-	termleader[len++] = DCS;    /* the termcode response starts with DCS
-				       in 8-bit mode */
+	termleader[len++] = DCS;    // the termcode response starts with DCS
+				    // in 8-bit mode
 #endif
     termleader[len] = NUL;
 
@@ -5665,17 +5662,17 @@ show_termcodes(void)
     int		i;
     int		len;
 
-#define INC3 27	    /* try to make three columns */
-#define INC2 40	    /* try to make two columns */
-#define GAP 2	    /* spaces between columns */
-
-    if (tc_len == 0)	    /* no terminal codes (must be GUI) */
+#define INC3 27	    // try to make three columns
+#define INC2 40	    // try to make two columns
+#define GAP 2	    // spaces between columns
+
+    if (tc_len == 0)	    // no terminal codes (must be GUI)
 	return;
     items = ALLOC_MULT(int, tc_len);
     if (items == NULL)
 	return;
 
-    /* Highlight title */
+    // Highlight title
     msg_puts_title(_("\n--- Terminal keys ---"));
 
     /*
@@ -5710,17 +5707,17 @@ show_termcodes(void)
 		cols = 1;
 	    rows = (item_count + cols - 1) / cols;
 	}
-	else	/* run == 3 */
+	else	// run == 3
 	    rows = item_count;
 	for (row = 0; row < rows && !got_int; ++row)
 	{
-	    msg_putchar('\n');			/* go to next line */
-	    if (got_int)			/* 'q' typed in more */
+	    msg_putchar('\n');			// go to next line
+	    if (got_int)			// 'q' typed in more
 		break;
 	    col = 0;
 	    for (i = row; i < item_count; i += rows)
 	    {
-		msg_col = col;			/* make columns */
+		msg_col = col;			// make columns
 		show_one_termcode(termcodes[items[i]].name,
 					      termcodes[items[i]].code, TRUE);
 		if (run == 2)
@@ -5810,12 +5807,12 @@ req_more_codes_from_term(void)
     char	buf[11];
     int		old_idx = xt_index_out;
 
-    /* Don't do anything when going to exit. */
+    // Don't do anything when going to exit.
     if (exiting)
 	return;
 
-    /* Send up to 10 more requests out than we received.  Avoid sending too
-     * many, there can be a buffer overflow somewhere. */
+    // Send up to 10 more requests out than we received.  Avoid sending too
+    // many, there can be a buffer overflow somewhere.
     while (xt_index_out < xt_index_in + 10 && key_names[xt_index_out] != NULL)
     {
 	char *key_name = key_names[xt_index_out];
@@ -5826,7 +5823,7 @@ req_more_codes_from_term(void)
 	++xt_index_out;
     }
 
-    /* Send the codes out right away. */
+    // Send the codes out right away.
     if (xt_index_out != old_idx)
 	out_flush();
 }
@@ -5847,12 +5844,12 @@ got_code_from_term(char_u *code, int len
     int		j = 0;
     int		c;
 
-    /* A '1' means the code is supported, a '0' means it isn't.
-     * When half the length is > XT_LEN we can't use it.
-     * Our names are currently all 2 characters. */
+    // A '1' means the code is supported, a '0' means it isn't.
+    // When half the length is > XT_LEN we can't use it.
+    // Our names are currently all 2 characters.
     if (code[0] == '1' && code[7] == '=' && len / 2 < XT_LEN)
     {
-	/* Get the name from the response and find it in the table. */
+	// Get the name from the response and find it in the table.
 	name[0] = hexhex2nr(code + 3);
 	name[1] = hexhex2nr(code + 5);
 	name[2] = NUL;
@@ -5874,13 +5871,13 @@ got_code_from_term(char_u *code, int len
 	    str[j] = NUL;
 	    if (name[0] == 'C' && name[1] == 'o')
 	    {
-		/* Color count is not a key code. */
+		// Color count is not a key code.
 		i = atoi((char *)str);
 		may_adjust_color_count(i);
 	    }
 	    else
 	    {
-		/* First delete any existing entry with the same code. */
+		// First delete any existing entry with the same code.
 		i = find_term_bykeys(str);
 		if (i >= 0)
 		    del_termcode_idx(i);
@@ -5889,7 +5886,7 @@ got_code_from_term(char_u *code, int len
 	}
     }
 
-    /* May request more codes now that we received one. */
+    // May request more codes now that we received one.
     ++xt_index_in;
     req_more_codes_from_term();
 }
@@ -5905,24 +5902,24 @@ check_for_codes_from_term(void)
 {
     int		c;
 
-    /* If no codes requested or all are answered, no need to wait. */
+    // If no codes requested or all are answered, no need to wait.
     if (xt_index_out == 0 || xt_index_out == xt_index_in)
 	return;
 
-    /* Vgetc() will check for and handle any response.
-     * Keep calling vpeekc() until we don't get any responses. */
+    // Vgetc() will check for and handle any response.
+    // Keep calling vpeekc() until we don't get any responses.
     ++no_mapping;
     ++allow_keys;
     for (;;)
     {
 	c = vpeekc();
-	if (c == NUL)	    /* nothing available */
+	if (c == NUL)	    // nothing available
 	    break;
 
-	/* If a response is recognized it's replaced with K_IGNORE, must read
-	 * it from the input stream.  If there is no K_IGNORE we can't do
-	 * anything, break here (there might be some responses further on, but
-	 * we don't want to throw away any typed chars). */
+	// If a response is recognized it's replaced with K_IGNORE, must read
+	// it from the input stream.  If there is no K_IGNORE we can't do
+	// anything, break here (there might be some responses further on, but
+	// we don't want to throw away any typed chars).
 	if (c != K_SPECIAL && c != K_IGNORE)
 	    break;
 	c = vgetc();
@@ -5987,11 +5984,11 @@ translate_mapping(char_u *str)
 		    return NULL;
 		}
 		c = TO_SPECIAL(str[1], str[2]);
-		if (c == K_ZERO)	/* display <Nul> as ^@ */
+		if (c == K_ZERO)	// display <Nul> as ^@
 		    c = NUL;
 		str += 2;
 	    }
-	    if (IS_SPECIAL(c) || modifiers)	/* special key */
+	    if (IS_SPECIAL(c) || modifiers)	// special key
 	    {
 		if (cpo_special)
 		{
@@ -5999,7 +5996,7 @@ translate_mapping(char_u *str)
 		    return NULL;
 		}
 		ga_concat(&ga, get_special_key_name(c, modifiers));
-		continue; /* for (str) */
+		continue; // for (str)
 	    }
 	}
 	if (c == ' ' || c == '\t' || c == Ctrl_J || c == Ctrl_V
@@ -6028,7 +6025,7 @@ update_tcap(int attr)
     p = find_builtin_term(DEFAULT_TERM);
     sprintf(ksme_str, IF_EB("\033|%dm", ESC_STR "|%dm"), attr);
     sprintf(ksmd_str, IF_EB("\033|%dm", ESC_STR "|%dm"),
-				     attr | 0x08);  /* FOREGROUND_INTENSITY */
+				     attr | 0x08);  // FOREGROUND_INTENSITY
     sprintf(ksmr_str, IF_EB("\033|%dm", ESC_STR "|%dm"),
 				 ((attr & 0x0F) << 4) | ((attr & 0xF0) >> 4));
 
@@ -6116,7 +6113,7 @@ swap_tcap(void)
 	CMODE256
     };
 
-    /* buffer initialization */
+    // buffer initialization
     if (!init_done)
     {
 	for (ks = ks_tbl; ks->code != (int)KS_NAME; ks++)
@@ -6218,9 +6215,9 @@ gui_adjust_rgb(guicolor_T c)
     guicolor_T
 gui_get_color_cmn(char_u *name)
 {
-    /* On MS-Windows an RGB macro is available and it produces 0x00bbggrr color
-     * values as used by the MS-Windows GDI api.  It should be used only for
-     * MS-Windows GDI builds. */
+    // On MS-Windows an RGB macro is available and it produces 0x00bbggrr color
+    // values as used by the MS-Windows GDI api.  It should be used only for
+    // MS-Windows GDI builds.
 # if defined(RGB) && defined(MSWIN) && !defined(FEAT_GUI)
 #  undef RGB
 # endif
@@ -6239,8 +6236,8 @@ gui_get_color_cmn(char_u *name)
 	guicolor_T  color;
     };
 
-    /* Only non X11 colors (not present in rgb.txt) and colors in
-     * color_names[], useful when $VIMRUNTIME is not found,. */
+    // Only non X11 colors (not present in rgb.txt) and colors in
+    // color_names[], useful when $VIMRUNTIME is not found,.
     static struct rgbcolor_table_S rgb_table[] = {
 	    {(char_u *)"black",		RGB(0x00, 0x00, 0x00)},
 	    {(char_u *)"blue",		RGB(0x00, 0x00, 0xFF)},
@@ -6253,7 +6250,7 @@ gui_get_color_cmn(char_u *name)
 	    {(char_u *)"darkgrey",	RGB(0xA9, 0xA9, 0xA9)},
 	    {(char_u *)"darkmagenta",	RGB(0x8B, 0x00, 0x8B)},
 	    {(char_u *)"darkred",	RGB(0x8B, 0x00, 0x00)},
-	    {(char_u *)"darkyellow",	RGB(0x8B, 0x8B, 0x00)}, /* No X11 */
+	    {(char_u *)"darkyellow",	RGB(0x8B, 0x8B, 0x00)}, // No X11
 	    {(char_u *)"gray",		RGB(0xBE, 0xBE, 0xBE)},
 	    {(char_u *)"green",		RGB(0x00, 0xFF, 0x00)},
 	    {(char_u *)"grey",		RGB(0xBE, 0xBE, 0xBE)},
@@ -6265,8 +6262,8 @@ gui_get_color_cmn(char_u *name)
 	    {(char_u *)"lightgray",	RGB(0xD3, 0xD3, 0xD3)},
 	    {(char_u *)"lightgreen",	RGB(0x90, 0xEE, 0x90)},
 	    {(char_u *)"lightgrey",	RGB(0xD3, 0xD3, 0xD3)},
-	    {(char_u *)"lightmagenta",	RGB(0xFF, 0x8B, 0xFF)}, /* No X11 */
-	    {(char_u *)"lightred",	RGB(0xFF, 0x8B, 0x8B)}, /* No X11 */
+	    {(char_u *)"lightmagenta",	RGB(0xFF, 0x8B, 0xFF)}, // No X11
+	    {(char_u *)"lightred",	RGB(0xFF, 0x8B, 0x8B)}, // No X11
 	    {(char_u *)"lightyellow",	RGB(0xFF, 0xFF, 0xE0)},
 	    {(char_u *)"magenta",	RGB(0xFF, 0x00, 0xFF)},
 	    {(char_u *)"red",		RGB(0xFF, 0x00, 0x00)},
@@ -6280,7 +6277,7 @@ gui_get_color_cmn(char_u *name)
 
     if (name[0] == '#' && STRLEN(name) == 7)
     {
-	/* Name is in "#rrggbb" format */
+	// Name is in "#rrggbb" format
 	color = RGB(((hex_digit(name[1]) << 4) + hex_digit(name[2])),
 		    ((hex_digit(name[3]) << 4) + hex_digit(name[4])),
 		    ((hex_digit(name[5]) << 4) + hex_digit(name[6])));
@@ -6289,7 +6286,7 @@ gui_get_color_cmn(char_u *name)
 	return gui_adjust_rgb(color);
     }
 
-    /* Check if the name is one of the colors we know */
+    // Check if the name is one of the colors we know
     for (i = 0; i < (int)(sizeof(rgb_table) / sizeof(rgb_table[0])); i++)
 	if (STRICMP(name, rgb_table[i].color_name) == 0)
 	    return gui_adjust_rgb(rgb_table[i].color);
@@ -6440,7 +6437,7 @@ cterm_color2rgb(int nr, char_u *r, char_
     }
     else if (nr < 232)
     {
-	/* 216 color cube */
+	// 216 color cube
 	idx = nr - 16;
 	*r = cube_value[idx / 36 % 6];
 	*g = cube_value[idx / 6  % 6];
@@ -6449,7 +6446,7 @@ cterm_color2rgb(int nr, char_u *r, char_
     }
     else if (nr < 256)
     {
-	/* 24 grey scale ramp */
+	// 24 grey scale ramp
 	idx = nr - 232;
 	*r = grey_ramp[idx];
 	*g = grey_ramp[idx];