Merge #12822 release-0.4 patches

This commit is contained in:
Justin M. Keyes 2020-09-06 10:34:44 -07:00 committed by GitHub
commit d9dd30a955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 10 deletions

View File

@ -5168,8 +5168,9 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that such processing is done after |:set| did its own round of
unescaping, so to keep yourself sane use |:let-&| like shown above.
*shell-powershell*
To use powershell (on Windows): >
set shell=powershell shellquote=( shellpipe=\| shellxquote=
To use powershell: >
let &shell = has('win32') ? 'powershell' : 'pwsh'
set shellquote= shellpipe=\| shellxquote=
set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
set shellredir=\|\ Out-File\ -Encoding\ UTF8

View File

@ -2692,8 +2692,8 @@ win_line (
off += col;
}
// wont highlight after 1024 columns
int term_attrs[1024] = {0};
// wont highlight after TERM_ATTRS_MAX columns
int term_attrs[TERM_ATTRS_MAX] = { 0 };
if (wp->w_buffer->terminal) {
terminal_get_line_attributes(wp->w_buffer->terminal, wp, lnum, term_attrs);
extra_check = true;
@ -4030,7 +4030,7 @@ win_line (
int n = wp->w_p_rl ? -1 : 1;
while (col >= 0 && col < grid->Columns) {
schar_from_ascii(linebuf_char[off], ' ');
linebuf_attr[off] = term_attrs[vcol];
linebuf_attr[off] = vcol >= TERM_ATTRS_MAX ? 0 : term_attrs[vcol];
off += n;
vcol += n;
col += n;

View File

@ -32,6 +32,9 @@ EXTERN ScreenGrid default_grid INIT(= SCREEN_GRID_INIT);
#define DEFAULT_GRID_HANDLE 1 // handle for the default_grid
// Maximum columns for terminal highlight attributes
#define TERM_ATTRS_MAX 1024
/// Status line click definition
typedef struct {
enum {

View File

@ -588,6 +588,7 @@ void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr,
return;
}
width = MIN(TERM_ATTRS_MAX, width);
for (int col = 0; col < width; col++) {
VTermScreenCell cell;
bool color_valid = fetch_cell(term, row, col, &cell);

View File

@ -500,9 +500,20 @@ function module.source(code)
end
function module.set_shell_powershell()
local shell = iswin() and 'powershell' or 'pwsh'
if not module.eval('executable("'..shell..'")') then
error(shell..' is not executable')
end
local aliases = iswin() and {'cat', 'sleep'} or {}
local cmd = ''
for _, alias in ipairs(aliases) do
cmd = cmd .. 'Remove-Item -Force alias:' .. alias .. ';'
end
module.source([[
set shell=powershell shellquote=( shellpipe=\| shellredir=> shellxquote=
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command Remove-Item -Force alias:sleep; Remove-Item -Force alias:cat;'
let &shell = ']]..shell..[['
set shellquote= shellpipe=\| shellxquote=
let &shellredir = '| Out-File -Encoding UTF8'
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command ]]..cmd..[['
]])
end

View File

@ -264,3 +264,12 @@ describe('No heap-buffer-overflow when using', function()
feed_command('bdelete!')
end)
end)
describe('No heap-buffer-overflow when', function()
it('set nowrap and send long line #11548', function()
feed_command('set nowrap')
feed_command('autocmd TermOpen * startinsert')
feed_command('call feedkeys("4000ai\\<esc>:terminal!\\<cr>")')
eq(2, eval('1+1'))
end)
end)

View File

@ -10,6 +10,7 @@ local iswin = helpers.iswin
local clear = helpers.clear
local command = helpers.command
local nvim_dir = helpers.nvim_dir
local set_shell_powershell = helpers.set_shell_powershell
describe("shell command :!", function()
local screen
@ -230,4 +231,19 @@ describe("shell command :!", function()
]])
end)
end)
if iswin() or eval('executable("pwsh")') == 1 then
it('powershell supports literal strings', function()
set_shell_powershell()
local screen = Screen.new(30, 4)
screen:attach()
feed_command([[!'echo $a']])
screen:expect{any='\necho %$a', timeout=10000}
feed_command([[!$a = 1; echo '$a']])
screen:expect{any='\n%$a', timeout=10000}
feed_command([[!"echo $a"]])
screen:expect{any='\necho', timeout=10000}
feed_command([[!$a = 1; echo "$a"]])
screen:expect{any='\n1', timeout=10000}
end)
end
end)

View File

@ -160,8 +160,8 @@ set(UNIBILIUM_SHA256 29815283c654277ef77a3adcc8840db79ddbb20a0f0b0c8f648bd8cd49a
set(LIBTERMKEY_URL http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.21.1.tar.gz)
set(LIBTERMKEY_SHA256 cecbf737f35d18f433c8d7864f63c0f878af41f8bd0255a3ebb16010dc044d5f)
set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/7c72294d84ce20da4c27362dbd7fa4b08cfc91da.tar.gz)
set(LIBVTERM_SHA256 f30c4d43e0c6db3e0912daf7188d98fbf6ee88f97589d72f6f304e5db48826a8)
set(LIBVTERM_URL http://www.leonerd.org.uk/code/libvterm/libvterm-0.1.4.tar.gz)
set(LIBVTERM_SHA256 bc70349e95559c667672fc8c55b9527d9db9ada0fb80a3beda533418d782d3dd)
set(LUV_VERSION 1.30.0-0)
set(LUV_URL https://github.com/luvit/luv/archive/${LUV_VERSION}.tar.gz)

View File

@ -27,7 +27,6 @@ function(BuildLibvterm)
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
PATCH_COMMAND "${_libvterm_PATCH_COMMAND}"
CONFIGURE_COMMAND ""
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND "${_libvterm_CONFIGURE_COMMAND}"
BUILD_COMMAND "${_libvterm_BUILD_COMMAND}"