Patch 8.2.2662
Problem: There is no way to avoid some escape sequences.
Solution: Suppress escape sequences when the --not-a-term argument is used.
(Gary Johnson)
Files: src/main.c, src/os_unix.c, src/testdir/test_startup.vim
*** ../vim-8.2.2661/src/main.c 2021-03-17 12:27:20.095476909 +0100
--- src/main.c 2021-03-27 11:47:38.666138329 +0100
***************
*** 995,1000 ****
--- 995,1013 ----
return params.not_a_term;
}
+ /*
+ * Return TRUE when the --not-a-term argument was found or the GUI is in use.
+ */
+ static int
+ is_not_a_term_or_gui()
+ {
+ return params.not_a_term
+ #ifdef FEAT_GUI
+ || gui.in_use
+ #endif
+ ;
+ }
+
// When TRUE in a safe state when starting to wait for a character.
static int was_safe = FALSE;
***************
*** 1528,1536 ****
#endif
// Position the cursor on the last screen line, below all the text
! #ifdef FEAT_GUI
! if (!gui.in_use)
! #endif
windgoto((int)Rows - 1, 0);
#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL)
--- 1541,1547 ----
#endif
// Position the cursor on the last screen line, below all the text
! if (!is_not_a_term_or_gui())
windgoto((int)Rows - 1, 0);
#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL)
***************
*** 1640,1648 ****
}
// Position the cursor again, the autocommands may have moved it
! #ifdef FEAT_GUI
! if (!gui.in_use)
! #endif
windgoto((int)Rows - 1, 0);
#ifdef FEAT_JOB_CHANNEL
--- 1651,1657 ----
}
// Position the cursor again, the autocommands may have moved it
! if (!is_not_a_term_or_gui())
windgoto((int)Rows - 1, 0);
#ifdef FEAT_JOB_CHANNEL
*** ../vim-8.2.2661/src/os_unix.c 2021-02-25 17:17:51.625163951 +0100
--- src/os_unix.c 2021-03-27 11:45:27.990574441 +0100
***************
*** 3343,3349 ****
else
out_char('\n');
}
! else
{
restore_cterm_colors(); // get original colors back
msg_clr_eos_force(); // clear the rest of the display
--- 3343,3349 ----
else
out_char('\n');
}
! else if (!is_not_a_term())
{
restore_cterm_colors(); // get original colors back
msg_clr_eos_force(); // clear the rest of the display
***************
*** 3370,3378 ****
{
settmode(TMODE_COOK);
#ifdef FEAT_TITLE
! // restore xterm title and icon name
! mch_restore_title(SAVE_RESTORE_BOTH);
! term_pop_title(SAVE_RESTORE_BOTH);
#endif
/*
* When t_ti is not empty but it doesn't cause swapping terminal
--- 3370,3381 ----
{
settmode(TMODE_COOK);
#ifdef FEAT_TITLE
! if (!is_not_a_term())
! {
! // restore xterm title and icon name
! mch_restore_title(SAVE_RESTORE_BOTH);
! term_pop_title(SAVE_RESTORE_BOTH);
! }
#endif
/*
* When t_ti is not empty but it doesn't cause swapping terminal
*** ../vim-8.2.2661/src/testdir/test_startup.vim 2021-03-26
17:24:30.931546613 +0100
--- src/testdir/test_startup.vim 2021-03-27 12:05:14.539535033 +0100
***************
*** 1043,1048 ****
--- 1043,1074 ----
\ 'Vim: Warning: Input is not from a terminal'], l)
endfunc
+ " Test for --not-a-term avoiding escape codes.
+ func Test_not_a_term()
+ CheckUnix
+ CheckNotGui
+
+ if &shellredir =~ '%s'
+ let redir = printf(&shellredir, 'Xvimout')
+ else
+ let redir = &shellredir .. ' Xvimout'
+ endif
+
+ " Without --not-a-term there are a few escape sequences.
+ " This will take 2 seconds because of the missing --not-a-term
+ let cmd = GetVimProg() .. ' --cmd quit ' .. redir
+ exe "silent !" . cmd
+ call assert_match("\<Esc>", readfile('Xvimout')->join())
+ call delete('Xvimout')
+
+ " With --not-a-term there are no escape sequences.
+ let cmd = GetVimProg() .. ' --not-a-term --cmd quit ' .. redir
+ exe "silent !" . cmd
+ call assert_notmatch("\<Esc>", readfile('Xvimout')->join())
+ call delete('Xvimout')
+ endfunc
+
+
" Test for the "-w scriptout" argument
func Test_w_arg()
" Can't catch the output of gvim.
*** ../vim-8.2.2661/src/version.c 2021-03-26 22:15:22.908192117 +0100
--- src/version.c 2021-03-27 12:05:36.855484980 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2662,
/**/
--
I'm not familiar with this proof, but I'm aware of a significant
following of toddlers who believe that peanut butter is the solution
to all of life's problems... -- Tim Hammerquist
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202103271113.12RBDh5D564268%40masaka.moolenaar.net.