0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.0.1126: bracketed paste can be enabled when it is not recognized

Problem:    Bracketed paste can be enabled when pasted text is not recognized.
Solution:   Output t_BE only when t_PS and t_PE are set.
This commit is contained in:
Bram Moolenaar 2023-01-01 18:04:33 +00:00
parent ec8b74f7ab
commit fc966c19f8
6 changed files with 27 additions and 5 deletions

View File

@ -1,4 +1,4 @@
*term.txt* For Vim version 9.0. Last change: 2022 Dec 31 *term.txt* For Vim version 9.0. Last change: 2023 Jan 01
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -118,6 +118,10 @@ have a problem with this, disable bracketed paste by putting this in your
If this is done while Vim is running the 't_BD' will be sent to the terminal If this is done while Vim is running the 't_BD' will be sent to the terminal
to disable bracketed paste. to disable bracketed paste.
If |t_PS| or |t_PE| is not set, then |t_BE| will not be used. This is to make
sure that bracketed paste is not enabled when the escape codes surrounding
pasted text cannot be recognized.
If your terminal supports bracketed paste, but the options are not set If your terminal supports bracketed paste, but the options are not set
automatically, you can try using something like this: > automatically, you can try using something like this: >

View File

@ -3714,7 +3714,7 @@ ins_esc(
MAY_WANT_TO_LOG_THIS; MAY_WANT_TO_LOG_THIS;
// Re-enable bracketed paste mode. // Re-enable bracketed paste mode.
out_str(T_BE); out_str_t_BE();
// Re-enable modifyOtherKeys. // Re-enable modifyOtherKeys.
out_str_t_TI(); out_str_t_TI();

View File

@ -454,7 +454,7 @@ normal_cmd_get_more_chars(
MAY_WANT_TO_LOG_THIS; MAY_WANT_TO_LOG_THIS;
// Re-enable bracketed paste mode and modifyOtherKeys // Re-enable bracketed paste mode and modifyOtherKeys
out_str(T_BE); out_str_t_BE();
out_str_t_TI(); out_str_t_TI();
} }

View File

@ -49,6 +49,7 @@ void shell_resized_check(void);
void set_shellsize(int width, int height, int mustset); void set_shellsize(int width, int height, int mustset);
void out_str_t_TE(void); void out_str_t_TE(void);
void out_str_t_TI(void); void out_str_t_TI(void);
void out_str_t_BE(void);
void may_send_t_RK(void); void may_send_t_RK(void);
void settmode(tmode_T tmode); void settmode(tmode_T tmode);
void starttermcap(void); void starttermcap(void);

View File

@ -3756,6 +3756,21 @@ out_str_t_TI(void)
send_t_RK = TRUE; send_t_RK = TRUE;
} }
/*
* Output T_BE, but only when t_PS and t_PE are set.
*/
void
out_str_t_BE(void)
{
char_u *p;
if (T_BE == NULL || *T_BE == NUL
|| (p = find_termcode((char_u *)"PS")) == NULL || *p == NUL
|| (p = find_termcode((char_u *)"PE")) == NULL || *p == NUL)
return;
out_str(T_BE);
}
/* /*
* If t_TI was recently sent and there is no typeahead or work to do, now send * If t_TI was recently sent and there is no typeahead or work to do, now send
* t_RK. This is postponed to avoid the response arriving in a shell command * t_RK. This is postponed to avoid the response arriving in a shell command
@ -3834,7 +3849,7 @@ settmode(tmode_T tmode)
} }
else else
{ {
out_str(T_BE); // enable bracketed paste mode (should out_str_t_BE(); // enable bracketed paste mode (should
// be before mch_settmode(). // be before mch_settmode().
out_str_t_TI(); // possibly enables modifyOtherKeys out_str_t_TI(); // possibly enables modifyOtherKeys
} }
@ -3862,7 +3877,7 @@ starttermcap(void)
out_str(T_TI); // start termcap mode out_str(T_TI); // start termcap mode
out_str_t_TI(); // start "raw" mode out_str_t_TI(); // start "raw" mode
out_str(T_KS); // start "keypad transmit" mode out_str(T_KS); // start "keypad transmit" mode
out_str(T_BE); // enable bracketed paste mode out_str_t_BE(); // enable bracketed paste mode
#if defined(UNIX) || defined(VMS) #if defined(UNIX) || defined(VMS)
// Enable xterm's focus reporting mode when 'esckeys' is set. // Enable xterm's focus reporting mode when 'esckeys' is set.

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1126,
/**/ /**/
1125, 1125,
/**/ /**/