changeset 7992:78106b0f2c56

commit https://github.com/vim/vim/commit/cbebd4879cc78e670d79b2c57dc33d7b911c962a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 7 23:02:56 2016 +0100 Updated runtime files.
author Christian Brabandt <cb@256bit.org>
date Sun, 07 Feb 2016 23:15:05 +0100
parents 689d10b97db7
children 0756eab66b71
files runtime/doc/channel.txt runtime/doc/eval.txt runtime/doc/tags runtime/doc/todo.txt runtime/ftplugin/man.vim runtime/indent/php.vim
diffstat 6 files changed, 94 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -117,7 +117,9 @@ Once done with the channel, disconnect i
 
 Currently up to 10 channels can be in use at the same time. *E897*
 
-When the channel can't be opened you will get an error message.
+When the channel can't be opened you will get an error message.  There is a
+difference between MS-Windows and Unix: On Unix when the port doesn't exist
+ch_open() fails quickly.  On MS-Windows "waittime" applies.
 *E898* *E899* *E900* *E901* *E902*
 
 If there is an error reading or writing a channel it will be closed.
@@ -169,6 +171,9 @@ channel does not have a handler the mess
 On read error or ch_close() the string "DETACH" is sent, if still possible.
 The channel will then be inactive.
 
+It is also possible to use ch_sendraw() on a JSON or JS channel.  The caller
+is then completely responsible for correct encoding and decoding.
+
 ==============================================================================
 4. Vim commands						*channel-commands*
 
@@ -266,6 +271,8 @@ asynchronously: >
 This {string} can also be JSON, use |jsonencode()| to create it and
 |jsondecode()| to handle a received JSON message.
 
+It is not possible to use |ch_sendexpr()| on a raw channel.
+
 ==============================================================================
 6. Job control						*job-control*
 
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2703,10 +2703,12 @@ ch_open({address} [, {argdict}])				*ch_
 		{only available when compiled with the |+channel| feature}
 
 ch_sendexpr({handle}, {expr} [, {callback}])		*ch_sendexpr()*
-		Send {expr} over JSON channel {handle}.  See |channel-use|.
+		Send {expr} over channel {handle}.  The {expr} is encoded
+		according to the type of channel.  The function cannot be used
+		with a raw channel.  See |channel-use|.  *E912*
 
 		When {callback} is given returns immediately.  Without
-		{callback} waits for a JSON response and returns the decoded
+		{callback} waits for a response and returns the decoded
 		expression.  When there is an error or timeout returns an
 		empty string.
 
@@ -2718,8 +2720,10 @@ ch_sendexpr({handle}, {expr} [, {callbac
 		{only available when compiled with the |+channel| feature}
 
 ch_sendraw({handle}, {string} [, {callback}])		*ch_sendraw()*
-		Send {string} over raw channel {handle}.  See |channel-raw|.
-		Works like |ch_sendexpr()|, but does not decode the response.
+		Send {string} over channel {handle}.
+		Works like |ch_sendexpr()|, but does not encode the request or
+		decode the response.  The caller is responsible for the
+		correct contents.  See |channel-use|.
 
 		{only available when compiled with the |+channel| feature}
 
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -4435,7 +4435,14 @@ E902	channel.txt	/*E902*
 E903	channel.txt	/*E903*
 E904	channel.txt	/*E904*
 E905	channel.txt	/*E905*
+E906	channel.txt	/*E906*
+E907	eval.txt	/*E907*
+E908	eval.txt	/*E908*
+E909	eval.txt	/*E909*
 E91	options.txt	/*E91*
+E910	eval.txt	/*E910*
+E911	eval.txt	/*E911*
+E912	eval.txt	/*E912*
 E92	message.txt	/*E92*
 E93	windows.txt	/*E93*
 E94	windows.txt	/*E94*
@@ -6811,8 +6818,13 @@ java.vim	syntax.txt	/*java.vim*
 javascript-cinoptions	indent.txt	/*javascript-cinoptions*
 javascript-indenting	indent.txt	/*javascript-indenting*
 job-control	channel.txt	/*job-control*
+job_start()	eval.txt	/*job_start()*
+job_status()	eval.txt	/*job_status()*
+job_stop()	eval.txt	/*job_stop()*
 join()	eval.txt	/*join()*
 jsbterm-mouse	options.txt	/*jsbterm-mouse*
+jsdecode()	eval.txt	/*jsdecode()*
+jsencode()	eval.txt	/*jsencode()*
 jsondecode()	eval.txt	/*jsondecode()*
 jsonencode()	eval.txt	/*jsonencode()*
 jtags	tagsrch.txt	/*jtags*
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.4.  Last change: 2016 Feb 04
+*todo.txt*      For Vim version 7.4.  Last change: 2016 Feb 07
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -81,32 +81,36 @@ Regexp problems:
   Patch by Christian, 2016 Jan 29.
 
 +channel:
-- use a timeout for connect()
-  Patch from Yasuhiro Matsumoto, Feb 2
-  Change connect() second argument to a dict with items:
-    mode
-    timeout
-    callback
+- implement job control:
+	job argument: redirect stdin/stdout
+	job argument: killonexit
+	let job = job_maystart('command', {address}, {options})
 - When receiving malformed json starting with a quote it doesn't get
   discarded.
+- add ch_status(): Whether channel is open.  Perhaps also mode, timeout.
+  When channel closes invoke channel callback.
 - add ch_setcallback()
 - add ch_settimeout()
 - cleanup on exit?  in mch_getout() and getout().
-- Add more contents to channel.txt
+- Add a test for the channel callback.
 - implement debug log
-- implement job control:
-	let job = job_start('command', {options})
-	call job_stop(job)
-	let job = job_maystart('command', {address}, {options})
-    options:
-        - keep running when Vim exits
-- add remark undo sync, is there a way to force it?
-- Add a test with a server that can send canned responses.
+- Add timestamp to queued messages and callbacks with ID, remove after a
+  minute.
+- add remark about undo sync, is there a way to force it?
 - Add more testing in json_test.c
 - make sure errors lead to a useful error msg. ["ex","foobar"]
-- set timeout for channel.
-- implement check for ID in response.
 - json: implement UTF-16 surrogate pair.
+- Need way to uniquely identify a window, no matter how windows are
+  rearranged.  Same for tab pages.
+      getwinid()             ID of current winow
+      getwinid({nr})         ID of window {nr}
+      getwinid({nr}, {tab})  ID of window {nr} in tab page {tab}
+      getwinnr({id})	     window nr of {id} or -1 if not open
+      gettabnr({id})	     tab page nr of {id} or -1 if not open
+      gotowin({id})
+  Make it so that the window ID can be used where currently a window nr is used
+- For connection to server, a "keep open" flag would be useful.  Retry
+  connecting in the main loop with zero timeout.
 
 Patch on #608: (Ken Takata)
 https://bitbucket.org/k_takata/vim-ktakata-mq/src/479934b94fd56b064c9e4bd8737585c5df69d56a/fix-gvimext-loadlibrary.patch?fileviewer=file-view-default
@@ -217,6 +221,8 @@ Patch to fix display of listchars on the
 Update suggested by Yasuhiro Matsumoto, 2014 Nov 25:
 https://gist.github.com/presuku/d3d6b230b9b6dcfc0477
 
+Patch to add TagNotFound autocommand. (Anton Lindqvist, 2016 Feb 3)
+
 Illegal memory access, requires ASAN to see. (Dominique Pelle, 2015 Jul 28)
 
 Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab.
@@ -265,6 +271,9 @@ Can we cache the syntax attributes, so t
 Build with Python on Mac does not always use the right library.
 (Kazunobu Kuriyama, 2015 Mar 28)
 
+Patch to add GTK 3 support. (Kazunobu Kuriyama, 2016 Feb 6)
+Does not fully work yet.
+
 Need a Vim equivalent of Python's None and a way to test for it.
 Use v:none.  var == v:none
 
@@ -621,6 +630,7 @@ Patch to add ":undorecover", get as much
 possible. (Christian Brabandt, 2014 Mar 12, update Aug 22)
 
 Include Haiku port? (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24)
+It can replace the BeOS code, which is likely not used anymore.
 
 Updated spec ftplugin. (Matěj Cepl, 2013 Oct 16)
 
@@ -2607,7 +2617,7 @@ 8   Basic flaw in the GUI code: NextScre
     Need better separation of Vim core and GUI code.
 8   When fontset support is enabled, setting 'guifont' to a single font
     doesn't work.
-8   Menu priority for sub-menus for: Amiga, BeOS.
+8   Menu priority for sub-menus for: Amiga.
 8   When translating menus ignore the part after the Tab, the shortcut.  So
     that the same menu item with a different shortcut (e.g., for the Mac) are
     still translated.
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language:	man
 " Maintainer:	SungHyun Nam <goweol@gmail.com>
-" Last Change: 	2015 Nov 24
+" Last Change: 	2016 Feb 04
 
 " To make the ":Man" command available before editing a manual page, source
 " this script from your startup vimrc file.
@@ -160,7 +160,9 @@ func <SID>GetPage(...)
 
   setl ma nonu nornu nofen
   silent exec "norm 1GdG"
-  let $MANWIDTH = winwidth(0)
+  if empty($MANWIDTH)
+    let $MANWIDTH = winwidth(0)
+  endif
   silent exec "r!/usr/bin/man ".s:GetCmdArg(sect, page)." | col -b"
   " Remove blank lines from top and bottom.
   while getline(1) =~ '^\s*$'
--- a/runtime/indent/php.vim
+++ b/runtime/indent/php.vim
@@ -3,8 +3,8 @@
 " Author:	John Wellesz <John.wellesz (AT) teaser (DOT) fr>
 " URL:		http://www.2072productions.com/vim/indent/php.vim
 " Home:		https://github.com/2072/PHP-Indenting-for-VIm
-" Last Change:	2014 November 26th
-" Version:	1.57
+" Last Change:	2015 September 8th
+" Version:	1.60
 "
 "
 "	Type :help php-indent for available options
@@ -50,16 +50,25 @@ let b:did_indent = 1
 
 let g:php_sync_method = 0
 
+if exists('*shiftwidth')
+  function! s:sw()
+    return shiftwidth()
+  endfunction
+else
+  function! s:sw()
+    return &shiftwidth
+  endfunction
+endif
 
 
 if exists("PHP_default_indenting")
-    let b:PHP_default_indenting = PHP_default_indenting * &sw
+    let b:PHP_default_indenting = PHP_default_indenting * s:sw()
 else
     let b:PHP_default_indenting = 0
 endif
 
 if exists("PHP_outdentSLComments")
-    let b:PHP_outdentSLComments = PHP_outdentSLComments * &sw
+    let b:PHP_outdentSLComments = PHP_outdentSLComments * s:sw()
 else
     let b:PHP_outdentSLComments = 0
 endif
@@ -124,7 +133,7 @@ endif
 
 if exists("*GetPhpIndent")
     call ResetPhpOptions()
-    finish " XXX -- comment this line for easy dev
+    finish
 endif
 
 
@@ -135,7 +144,7 @@ let s:functionDecl = '\<function\>\%(\s\
 let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
 
 
-let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
+let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
 let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
 
 
@@ -200,7 +209,7 @@ function! GetLastRealCodeLNum(startline)
 
 
 	elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc
-	    let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<''\\=\1''\\=$', '')
+	    let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<\\s*[''"]\\=\1[''"]\\=$', '')
 	    while getline(lnum) !~? tofind && lnum > 1
 		let lnum = lnum - 1
 	    endwhile
@@ -314,7 +323,7 @@ function! FindTheSwitchIndent (lnum) " {
     let test = GetLastRealCodeLNum(a:lnum - 1)
 
     if test <= 1
-	return indent(1) - &sw * b:PHP_vintage_case_default_indent
+	return indent(1) - s:sw() * b:PHP_vintage_case_default_indent
     end
 
     while getline(test) =~ '^\s*}' && test > 1
@@ -328,7 +337,7 @@ function! FindTheSwitchIndent (lnum) " {
     if getline(test) =~# '^\s*switch\>'
 	return indent(test)
     elseif getline(test) =~# s:defaultORcase
-	return indent(test) - &sw * b:PHP_vintage_case_default_indent
+	return indent(test) - s:sw() * b:PHP_vintage_case_default_indent
     else
 	return FindTheSwitchIndent(test)
     endif
@@ -401,7 +410,7 @@ function! GetPhpIndent()
     endif
 
     if b:PHP_default_indenting
-	let b:PHP_default_indenting = g:PHP_default_indenting * &sw
+	let b:PHP_default_indenting = g:PHP_default_indenting * s:sw()
     endif
 
     let cline = getline(v:lnum)
@@ -439,6 +448,7 @@ function! GetPhpIndent()
 
     if !b:InPHPcode_checked " {{{ One time check
 	let b:InPHPcode_checked = 1
+	let b:UserIsTypingComment = 0
 
 	let synname = ""
 	if cline !~ '<?.*?>'
@@ -447,8 +457,7 @@ function! GetPhpIndent()
 
 	if synname!=""
 	    if synname == "SpecStringEntrails"
-		let b:InPHPcode = -1 " thumb down
-		let b:UserIsTypingComment = 0
+		let b:InPHPcode = -1
 		let b:InPHPcode_tofind = ""
 	    elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter"
 		let b:InPHPcode = 1
@@ -456,8 +465,7 @@ function! GetPhpIndent()
 
 		if synname =~# '^php\%(Doc\)\?Comment'
 		    let b:UserIsTypingComment = 1
-		else
-		    let b:UserIsTypingComment = 0
+		    let b:InPHPcode_checked = 0
 		endif
 
 		if synname =~? '^javaScript'
@@ -466,18 +474,16 @@ function! GetPhpIndent()
 
 	    else
 		let b:InPHPcode = 0
-		let b:UserIsTypingComment = 0
 
 		let lnum = v:lnum - 1
-		while getline(lnum) !~? '<<<''\=\a\w*''\=$' && lnum > 1
+		while getline(lnum) !~? '<<<\s*[''"]\=\a\w*[''"]\=$' && lnum > 1
 		    let lnum = lnum - 1
 		endwhile
 
-		let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '')
+		let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '')
 	    endif
 	else
 	    let b:InPHPcode = 0
-	    let b:UserIsTypingComment = 0
 	    let b:InPHPcode_tofind = s:PHP_startindenttag
 	endif
     endif "!b:InPHPcode_checked }}}
@@ -537,9 +543,9 @@ function! GetPhpIndent()
 	elseif last_line =~ '^[^''"`]\+[''"`]$'
 	    let b:InPHPcode = -1
 	    let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '')
-	elseif last_line =~? '<<<''\=\a\w*''\=$'
+	elseif last_line =~? '<<<\s*[''"]\=\a\w*[''"]\=$'
 	    let b:InPHPcode = 0
-	    let b:InPHPcode_tofind = substitute( last_line, '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '')
+	    let b:InPHPcode_tofind = substitute( last_line, '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '')
 
 	elseif !UserIsEditing && cline =~ '^\s*/\*\%(.*\*/\)\@!' && getline(v:lnum + 1) !~ '^\s*\*'
 	    let b:InPHPcode = 0
@@ -660,7 +666,7 @@ function! GetPhpIndent()
 	let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
 	return indent(FindTheIfOfAnElse(v:lnum, 1))
     elseif cline =~# s:defaultORcase
-	return FindTheSwitchIndent(v:lnum) + &sw * b:PHP_vintage_case_default_indent
+	return FindTheSwitchIndent(v:lnum) + s:sw() * b:PHP_vintage_case_default_indent
     elseif cline =~ '^\s*)\=\s*{'
 	let previous_line = last_line
 	let last_line_num = lnum
@@ -672,7 +678,7 @@ function! GetPhpIndent()
 		let ind = indent(last_line_num)
 
 		if  b:PHP_BracesAtCodeLevel
-		    let ind = ind + &sw
+		    let ind = ind + s:sw()
 		endif
 
 		return ind
@@ -683,7 +689,7 @@ function! GetPhpIndent()
 	endwhile
 
     elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
-	let ind = ind + &sw
+	let ind = ind + s:sw()
 	return ind + addSpecial
 
     elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated
@@ -782,7 +788,7 @@ function! GetPhpIndent()
 	    endif
 
 	    if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{')
-		let ind = ind + &sw
+		let ind = ind + s:sw()
 	    endif
 
 	    if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
@@ -800,17 +806,17 @@ function! GetPhpIndent()
 	    endif
 
 	elseif last_line =~ '^\s*'.s:blockstart
-	    let ind = ind + &sw
+	    let ind = ind + s:sw()
 
 
     elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase
-	    let ind = ind + &sw
+	    let ind = ind + s:sw()
 	endif
 
     endif
 
     if cline =~  '^\s*[)\]];\='
-	let ind = ind - &sw
+	let ind = ind - s:sw()
     endif
 
     let b:PHP_CurrentIndentLevel = ind