diff src/term.c @ 26400:d26bab4f6aca v8.2.3731

patch 8.2.3731: "set! termcap" shows codes in one column, but not keys Commit: https://github.com/vim/vim/commit/15a24f08987e3831be255333bb84b7bc9c00db24 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 3 20:43:24 2021 +0000 patch 8.2.3731: "set! termcap" shows codes in one column, but not keys Problem: "set! termcap" shows codes in one column, but not keys. Solution: Also use one column for keys. (closes https://github.com/vim/vim/issues/9258)
author Bram Moolenaar <Bram@vim.org>
date Fri, 03 Dec 2021 21:45:03 +0100
parents 201243ceaa18
children b18f3b0f317c
line wrap: on
line diff
--- a/src/term.c
+++ b/src/term.c
@@ -6217,9 +6217,10 @@ gather_termleader(void)
 /*
  * Show all termcodes (for ":set termcap")
  * This code looks a lot like showoptions(), but is different.
+ * "flags" can have OPT_ONECOLUMN.
  */
     void
-show_termcodes(void)
+show_termcodes(int flags)
 {
     int		col;
     int		*items;
@@ -6244,12 +6245,13 @@ show_termcodes(void)
     msg_puts_title(_("\n--- Terminal keys ---"));
 
     /*
-     * do the loop two times:
+     * Do the loop three times:
      * 1. display the short items (non-strings and short strings)
      * 2. display the medium items (medium length strings)
      * 3. display the long items (remaining strings)
+     * When "flags" has OPT_ONECOLUMN do everything in 3.
      */
-    for (run = 1; run <= 3 && !got_int; ++run)
+    for (run = (flags & OPT_ONECOLUMN) ? 3 : 1; run <= 3 && !got_int; ++run)
     {
 	/*
 	 * collect the items in items[]
@@ -6259,9 +6261,10 @@ show_termcodes(void)
 	{
 	    len = show_one_termcode(termcodes[i].name,
 						    termcodes[i].code, FALSE);
-	    if (len <= INC3 - GAP ? run == 1
+	    if ((flags & OPT_ONECOLUMN) ||
+		    (len <= INC3 - GAP ? run == 1
 			: len <= INC2 - GAP ? run == 2
-			: run == 3)
+			: run == 3))
 		items[item_count++] = i;
 	}