Control: tags -1 fixed-upstream patch
Control: forwarded -1 https://github.com/vim/vim/issues/11766

On 2023-01-01 18:25 +0100, Sven Joachim wrote:

> So far so good, and I have already prepared ncurses 6.4-1 in git.  Now
> the bad news: it turned out that bracketed paste support in vim had
> (always?) been broken without anybody noticing it, because no terminal
> descriptions had included this feature.  Only two days ago Bram
> Moolenaar fixed the problem in patch 9.0.1117[1].

> I have backported this patch to the debian/sid branch in vim's git
> repository and can confirm that it fixes the problem, as long as
> ncurses-base is also upgraded to version 6.4-1.

See the attached patch which I used as the last one in the series file.
If you want to reorder it so that it comes before the 9.0.1118 backport,
you need to edit the src/version.c hunks in both patches so that they
apply cleanly.

There has also been some discussion in the upstream issue #11766,
although that is rather confusing as some people had the ncurses
20221224 patchlevel installed and not upgraded to the corrected ncurses
6.4 release.  In this case, no vim patch would help (see #1027435).

Cheers,
       Sven

From 7b8db111e819bcb07cff6fc451584b0e3e0a49fd Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <b...@vim.org>
Date: Fri, 30 Dec 2022 21:10:25 +0000
Subject: [PATCH] patch 9.0.1117: terminfo entries for bracketed paste are not
 used

Problem:    Terminfo entries for bracketed paste are not used.
Solution:   Use the newly added terminfo entries for bracketed paste.
            Correct mixup of output strings and key codes.
---
 src/term.c     | 10 +++++-----
 src/termdefs.h |  4 ----
 src/version.c  |  2 ++
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/term.c b/src/term.c
index e83c198bdf2e..e7466e684f03 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1674,6 +1674,7 @@ static char *(key_names[]) =
     "k7", "k8", "k9", "k;", "F1", "F2",
     "%1", "&8", "kb", "kI", "kD", "kh",
     "@7", "kP", "kN", "K1", "K3", "K4", "K5", "kB",
+    "PS", "PE",
     NULL
 };
 #endif
@@ -1730,13 +1731,11 @@ get_term_entries(int *height, int *width)
 			{KS_U7, "u7"}, {KS_RFG, "RF"}, {KS_RBG, "RB"},
 			{KS_8F, "8f"}, {KS_8B, "8b"}, {KS_8U, "8u"},
 			{KS_CBE, "BE"}, {KS_CBD, "BD"},
-			{KS_CPS, "PS"}, {KS_CPE, "PE"},
 			{KS_CST, "ST"}, {KS_CRT, "RT"},
 			{KS_SSI, "Si"}, {KS_SRI, "Ri"},
 			{(enum SpecialKey)0, NULL}
 		    };
     int		    i;
-    char_u	    *p;
     static char_u   tstrbuf[TBUFSZ];
     char_u	    *tp = tstrbuf;

@@ -1775,7 +1774,8 @@ get_term_entries(int *height, int *width)
     for (i = 0; key_names[i] != NULL; ++i)
 	if (find_termcode((char_u *)key_names[i]) == NULL)
 	{
-	    p = TGETSTR(key_names[i], &tp);
+	    char_u *p = TGETSTR(key_names[i], &tp);
+
 	    // if cursor-left == backspace, ignore it (televideo 925)
 	    if (p != NULL
 		    && (*p != Ctrl_H
@@ -1803,8 +1803,8 @@ get_term_entries(int *height, int *width)
 # ifndef hpux
     BC = (char *)TGETSTR("bc", &tp);
     UP = (char *)TGETSTR("up", &tp);
-    p = TGETSTR("pc", &tp);
-    if (p)
+    char_u *p = TGETSTR("pc", &tp);
+    if (p != NULL)
 	PC = *p;
 # endif
 }
diff --git a/src/termdefs.h b/src/termdefs.h
index 9e9601f1a918..a258dadb7265 100644
--- a/src/termdefs.h
+++ b/src/termdefs.h
@@ -108,8 +108,6 @@ enum SpecialKey
     KS_8U,	// set underline color (RGB)
     KS_CBE,	// enable bracketed paste mode
     KS_CBD,	// disable bracketed paste mode
-    KS_CPS,	// start of bracketed paste
-    KS_CPE,	// end of bracketed paste
     KS_CST,	// save window title
     KS_CRT,	// restore window title
     KS_SSI,	// save icon text
@@ -216,8 +214,6 @@ extern char_u *(term_strings[]);    // current terminal strings
 #define T_8U	(TERM_STR(KS_8U))	// set underline color (RGB)
 #define T_BE	(TERM_STR(KS_CBE))	// enable bracketed paste mode
 #define T_BD	(TERM_STR(KS_CBD))	// disable bracketed paste mode
-#define T_PS	(TERM_STR(KS_CPS))	// start of bracketed paste
-#define T_PE	(TERM_STR(KS_CPE))	// end of bracketed paste
 #define T_CST	(TERM_STR(KS_CST))	// save window title
 #define T_CRT	(TERM_STR(KS_CRT))	// restore window title
 #define T_SSI	(TERM_STR(KS_SSI))	// save icon text
diff --git a/src/version.c b/src/version.c
index 429d76c4c4f7..9c64a27b110a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -695,6 +695,8 @@ static char *(features[]) =

 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1117,
 /**/
     1118,
 /**/

Reply via email to