From 944e3c06193f6d10baa9ba3021e01626337dd884 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 26 Nov 2017 23:15:17 +0100 Subject: tui: expose terminal type in 'term' option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since "builtin" terminfo definitions were implemented (7cbf52db1bdf), the decisions made by tui.c and terminfo.c are more relevant. Exposing that decision in the 'term' option helps with troubleshooting. Also: remove code that allowed setting t_Co. `:set t_Co=…` has never worked; the highlight_spec test asserting that nvim_set_option('t_Co') _does_ work makes no sense, and should not have worked. --- runtime/doc/vim_diff.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 026ff6a0fb..c8155f7a68 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -333,9 +333,11 @@ terminal capabilities. Instead Nvim treats the terminal as any other UI. For example, 'guicursor' sets the terminal cursor style if possible. *'term'* *E529* *E530* *E531* -The 'term' option has a fixed value, present only for script compatibility and -intentionally not the same as any known terminal type name. It should be a -rare case in Nvim where one needs |term-dependent-settings|. +'term' reflects the terminal type derived from |$TERM| and other environment +checks. For debugging only; not reliable during startup. > + :echo &term +"builtin_x" means one of the |builtin-terms| was chosen, because the expected +terminfo file was not found on the system. *termcap* Nvim never uses the termcap database, only |terminfo| and |builtin-terms|. -- cgit From df019cebd59a456d6f7dc5948703fdd2059c4b04 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Mon, 27 Nov 2017 11:06:43 +0100 Subject: Revert "provider: delete vimL stderr collector, now that it exists builtin" This change exposed a memory issue with buffered channels, possibly involving GC. Revert until it has been fixed. This reverts commit 0de019b6a65c6dd5141b7e002343df3689065ce7. --- runtime/autoload/provider.vim | 20 ++++++++++++++++++++ runtime/autoload/provider/clipboard.vim | 6 ++++-- runtime/autoload/provider/node.vim | 9 +++++---- runtime/autoload/provider/pythonx.vim | 9 +++++---- 4 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 runtime/autoload/provider.vim (limited to 'runtime') diff --git a/runtime/autoload/provider.vim b/runtime/autoload/provider.vim new file mode 100644 index 0000000000..e6514f5ba8 --- /dev/null +++ b/runtime/autoload/provider.vim @@ -0,0 +1,20 @@ +" Common functionality for providers + +let s:stderr = {} + +function! provider#stderr_collector(chan_id, data, event) + let stderr = get(s:stderr, a:chan_id, ['']) + let stderr[-1] .= a:data[0] + call extend(stderr, a:data[1:]) + let s:stderr[a:chan_id] = stderr +endfunction + +function! provider#clear_stderr(chan_id) + if has_key(s:stderr, a:chan_id) + call remove(s:stderr, a:chan_id) + endif +endfunction + +function! provider#get_stderr(chan_id) + return get(s:stderr, a:chan_id, []) +endfunction diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 381fe2cf2d..6454a01c2a 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -7,7 +7,7 @@ let s:clipboard = {} " When caching is enabled, store the jobid of the xclip/xsel process keeping " ownership of the selection, so we know how long the cache is valid. -let s:selection = { 'owner': 0, 'data': [], 'stderr_buffered': v:true } +let s:selection = { 'owner': 0, 'data': [], 'on_stderr': function('provider#stderr_collector') } function! s:selection.on_exit(jobid, data, event) abort " At this point this nvim instance might already have launched @@ -16,10 +16,12 @@ function! s:selection.on_exit(jobid, data, event) abort let self.owner = 0 endif if a:data != 0 + let stderr = provider#get_stderr(a:jobid) echohl WarningMsg - echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(self.stderr) + echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(stderr) echohl None endif + call provider#clear_stderr(a:jobid) endfunction let s:selections = { '*': s:selection, '+': copy(s:selection) } diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim index 419dd517cd..b08ad4f316 100644 --- a/runtime/autoload/provider/node.vim +++ b/runtime/autoload/provider/node.vim @@ -3,7 +3,7 @@ if exists('g:loaded_node_provider') endif let g:loaded_node_provider = 1 -let s:job_opts = {'rpc': v:true, 'stderr_buffered': v:true} +let s:job_opts = {'rpc': v:true, 'on_stderr': function('provider#stderr_collector')} function! provider#node#Detect() abort return has('win32') ? exepath('neovim-node-host.cmd') : exepath('neovim-node-host') @@ -32,18 +32,19 @@ function! provider#node#Require(host) abort endif try - let job = copy(s:job_opts) - let channel_id = jobstart(args, job) + let channel_id = jobstart(args, s:job_opts) if rpcrequest(channel_id, 'poll') ==# 'ok' return channel_id endif catch echomsg v:throwpoint echomsg v:exception - for row in job.stderr + for row in provider#get_stderr(channel_id) echomsg row endfor endtry + finally + call provider#clear_stderr(channel_id) endtry throw remote#host#LoadErrorForHost(a:host.orig_name, '$NVIM_NODE_LOG_FILE') endfunction diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index 1c77eabe23..7285ed43ea 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -5,7 +5,7 @@ endif let s:loaded_pythonx_provider = 1 -let s:job_opts = {'rpc': v:true, 'stderr_buffered': v:true} +let s:job_opts = {'rpc': v:true, 'on_stderr': function('provider#stderr_collector')} function! provider#pythonx#Require(host) abort let ver = (a:host.orig_name ==# 'python') ? 2 : 3 @@ -21,17 +21,18 @@ function! provider#pythonx#Require(host) abort endfor try - let job = copy(s:job_opts) - let channel_id = jobstart(args, job) + let channel_id = jobstart(args, s:job_opts) if rpcrequest(channel_id, 'poll') ==# 'ok' return channel_id endif catch echomsg v:throwpoint echomsg v:exception - for row in job.stderr + for row in provider#get_stderr(channel_id) echomsg row endfor + finally + call provider#clear_stderr(channel_id) endtry throw remote#host#LoadErrorForHost(a:host.orig_name, \ '$NVIM_PYTHON_LOG_FILE') -- cgit From 2d732a11b1ef12b3a3458f45f2f170954ad3bdc6 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 28 Nov 2017 21:19:33 -0500 Subject: provider: fix batchfile extension for ruby gem (#7651) ruby uses batchfiles with 'cmd' extension. gem creates batchfiles with 'bat' extension. `gem install rails` does the following in Windows (not Cygwin): 1. Run `gem.cmd install rails` on cmd.exe 2. gem.cmd runs `ruby.exe -x gem install rails` 3. `rails` gem is installed. `rails.bat` is created in the same directory where ruby.exe and gem.cmd reside. --- runtime/autoload/provider/ruby.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim index 518a9dc793..da73a0dfc0 100644 --- a/runtime/autoload/provider/ruby.vim +++ b/runtime/autoload/provider/ruby.vim @@ -19,7 +19,7 @@ function! provider#ruby#Detect() abort if exists("g:ruby_host_prog") return g:ruby_host_prog else - return has('win32') ? exepath('neovim-ruby-host.cmd') : exepath('neovim-ruby-host') + return has('win32') ? exepath('neovim-ruby-host.bat') : exepath('neovim-ruby-host') end endfunction -- cgit