From aa3b15dbebf333282503d6031e2f9ba6ee4398ed Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 08:53:19 +0200 Subject: [PATCH 01/11] Updated runtime files. --- runtime/autoload/netrw.vim | 502 ++++++++++++++++----------------- runtime/doc/autocmd.txt | 5 +- runtime/doc/change.txt | 6 +- runtime/doc/channel.txt | 4 +- runtime/doc/editing.txt | 2 +- runtime/doc/eval.txt | 60 ++-- runtime/doc/if_cscop.txt | 4 +- runtime/doc/if_pyth.txt | 2 +- runtime/doc/if_tcl.txt | 2 +- runtime/doc/index.txt | 7 +- runtime/doc/map.txt | 2 +- runtime/doc/netbeans.txt | 2 +- runtime/doc/options.txt | 10 +- runtime/doc/pattern.txt | 6 +- runtime/doc/pi_netrw.txt | 27 +- runtime/doc/tags | 23 +- runtime/doc/term.txt | 2 +- runtime/doc/todo.txt | 111 ++++---- runtime/doc/version8.txt | 20 +- runtime/indent/vim.vim | 4 +- runtime/plugin/netrwPlugin.vim | 2 +- runtime/syntax/php.vim | 4 +- 22 files changed, 415 insertions(+), 392 deletions(-) diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 64c08e98fa..de85844d5d 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,7 +1,7 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Feb 16, 2016 -" Version: 155 ASTRO-ONLY +" Date: Apr 20, 2016 +" Version: 156 " Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 @@ -13,7 +13,7 @@ " expressed or implied. By using this plugin, you agree that " in no event will the copyright holder be liable for any damages " resulting from the use of this software. -"redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore(,'~'.expand("")) +"redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore() " " But be doers of the Word, and not only hearers, deluding your own selves {{{1 " (James 1:22 RSV) @@ -30,7 +30,7 @@ if v:version < 704 || !has("patch213") let s:needpatch213= 1 finish endif -let g:loaded_netrw = "v155" +let g:loaded_netrw = "v156" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -444,7 +444,7 @@ call s:NetrwInit("g:netrw_markfileesc" , '*./[\~') call s:NetrwInit("g:netrw_maxfilenamelen", 32) call s:NetrwInit("g:netrw_menu" , 1) call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir") -call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~ '[anh]')) +call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~# '[anh]')) call s:NetrwInit("g:netrw_retmap" , 0) if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") @@ -490,6 +490,7 @@ if !exists("g:netrw_sort_sequence") endif call s:NetrwInit("g:netrw_special_syntax" , 0) call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$') +call s:NetrwInit("g:netrw_suppress_gx_mesg", 1) call s:NetrwInit("g:netrw_use_noswf" , 1) call s:NetrwInit("g:netrw_sizestyle" ,"b") " Default values - t-w ---------- {{{3 @@ -526,6 +527,7 @@ if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4' else let s:treedepthstring= "| " endif +call s:NetrwInit("s:netrw_nbcd",'{}') " BufEnter event ignored by decho when following variable is true " Has a side effect that doau BufReadPost doesn't work, so @@ -551,7 +553,7 @@ if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists( endif au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif -if g:netrw_keepj =~ "keepj" +if g:netrw_keepj =~# "keepj" com! -nargs=* NetrwKeepj keepj else let g:netrw_keepj= "" @@ -821,7 +823,7 @@ fun! netrw#Explore(indx,dosplit,style,...) let dirname= curfiledir " call Decho("..empty dirname, using current file's directory<".dirname.">",'~'.expand("")) endif - if dirname =~ '^scp://' || dirname =~ '^ftp://' + if dirname =~# '^scp://' || dirname =~ '^ftp://' call netrw#Nread(2,dirname) else if dirname == "" @@ -1560,15 +1562,7 @@ fun! s:NetrwOptionRestore(vt) " call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) if !exists("{a:vt}netrw_optionsave") - if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring posn to s:nbcd_curpos_".bufnr('%')."<".string(s:nbcd_curpos_{bufnr('%')}).">",'~'.expand("")) - NetrwKeepj call winrestview(s:nbcd_curpos_{bufnr('%')}) -" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$"),'~'.expand("")) -" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("")) - unlet s:nbcd_curpos_{bufnr('%')} - else -" call Decho("no previous position",'~'.expand("")) - endif + call s:RestorePosn(s:netrw_nbcd) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") @@ -1656,16 +1650,7 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_regstar") |sil! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif endif if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif - if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring posn to s:nbcd_curpos_".bufnr('%')."<".string(s:nbcd_curpos_{bufnr('%')}).">",'~'.expand("")) - NetrwKeepj call winrestview(s:nbcd_curpos_{bufnr('%')}) -" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("")) - if exists("s:nbcd_curpos_".bufnr('%')) - unlet s:nbcd_curpos_{bufnr('%')} - endif - else -" call Decho("no previous position",'~'.expand("")) - endif + call s:RestorePosn(s:netrw_nbcd) " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("")) " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("")) @@ -3016,10 +3001,10 @@ fun! s:NetrwMethod(choice) if exists("s:netrw_hup[host]") call NetUserPass("ftp:".host) - elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~ '-[sS]:' + elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~# '-[sS]:' " call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("")) " call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">",'~'.expand("")) - if g:netrw_ftp_cmd =~ '-[sS]:\S*MACHINE\>' + if g:netrw_ftp_cmd =~# '-[sS]:\S*MACHINE\>' let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\',g:netrw_machine,'') " call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("")) endif @@ -3583,7 +3568,7 @@ fun! s:NetrwBrowse(islocal,dirname) " This is useful when one edits a local file, then :e ., then :Rex if a:islocal && !exists("w:netrw_rexfile") && bufname("#") != "" let w:netrw_rexfile= bufname("#") -" call Decho("setting w:netrw_rexfile<".w:netrw_rexfile."> win#".winnr()) +" call Decho("setting w:netrw_rexfile<".w:netrw_rexfile."> win#".winnr(),'~'.expand("")) endif " s:NetrwBrowse : initialize history {{{3 @@ -3773,7 +3758,7 @@ fun! s:NetrwBrowse(islocal,dirname) " analyze dirname and g:netrw_list_cmd {{{3 " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">",'~'.expand("")) - if dirname =~ "^NetrwTreeListing\>" + if dirname =~# "^NetrwTreeListing\>" let dirname= b:netrw_curdir " call Decho("(dirname was ) dirname<".dirname.">",'~'.expand("")) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") @@ -3854,15 +3839,15 @@ endfun " directory is used. fun! s:NetrwFile(fname) " call Dfunc("s:NetrwFile(fname<".a:fname.">) win#".winnr()) -" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a')) -" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a')) -" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a')) -" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) +" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("")) +" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a'),'~'.expand("")) +" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a'),'~'.expand("")) +" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("")) " clean up any leading treedepthstring if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST let fname= substitute(a:fname,'^'.s:treedepthstring.'\+','','') -" call Decho("clean up any leading treedepthstring: fname<".fname.">") +" call Decho("clean up any leading treedepthstring: fname<".fname.">",'~'.expand("")) else let fname= a:fname endif @@ -3897,6 +3882,8 @@ fun! s:NetrwFile(fname) " vim and netrw agree on the current directory let ret= fname " call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("")) +" call Decho("vim directory: ".getcwd(),'~'.expand("")) +" call Decho("netrw directory: ".(exists("b:netrw_curdir")? b:netrw_curdir : 'n/a'),'~'.expand("")) endif " call Dret("s:NetrwFile ".ret) @@ -3910,9 +3897,9 @@ fun! s:NetrwFileInfo(islocal,fname) let ykeep= @@ if a:islocal let lsopt= "-lsad" - if g:netrw_sizestyle =~ 'H' + if g:netrw_sizestyle =~# 'H' let lsopt= "-lsadh" - elseif g:netrw_sizestyle =~ 'h' + elseif g:netrw_sizestyle =~# 'h' let lsopt= "-lsadh --si" endif if (has("unix") || has("macunix")) && executable("/bin/ls") @@ -3944,7 +3931,7 @@ fun! s:NetrwFileInfo(islocal,fname) endif let t = getftime(s:NetrwFile(fname)) let sz = getfsize(s:NetrwFile(fname)) - if g:netrw_sizestyle =~ "[hH]" + if g:netrw_sizestyle =~# "[hH]" let sz= s:NetrwHumanReadable(sz) endif echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(s:NetrwFile(fname))) @@ -3957,6 +3944,21 @@ fun! s:NetrwFileInfo(islocal,fname) " call Dret("s:NetrwFileInfo") endfun +" --------------------------------------------------------------------- +" s:NetrwFullPath: returns the full path to a directory and/or file {{{2 +fun! s:NetrwFullPath(filename) +" " call Dfunc("s:NetrwFullPath(filename<".a:filename.">)") + let filename= a:filename + if filename !~ '^/' + let filename= resolve(getcwd().'/'.filename) + endif + if filename != "/" && filename =~ '/$' + let filename= substitute(filename,'/$','','') + endif +" " call Dret("s:NetrwFullPath <".filename.">") + return filename +endfun + " --------------------------------------------------------------------- " s:NetrwGetBuffer: {{{2 " returns 0=cleared buffer @@ -3964,102 +3966,28 @@ endfun fun! s:NetrwGetBuffer(islocal,dirname) " call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) +" call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("")) let dirname= a:dirname " re-use buffer if possible {{{3 " call Decho("--re-use a buffer if possible--",'~'.expand("")) - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - " find NetrwTreeList buffer if there is one -" call Decho("case liststyle=treelist: find NetrwTreeList buffer if there is one",'~'.expand("")) - if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 -" call Decho(" re-using w:netrw_treebufnr=".w:netrw_treebufnr,'~'.expand("")) - let eikeep= &ei - setl ei=all - exe "sil! keepj noswapfile keepalt b ".w:netrw_treebufnr - let &ei= eikeep - setl ma - sil! NetrwKeepj %d _ -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Dret("s:NetrwGetBuffer 0 : bufnum#".w:netrw_treebufnr."") - return 0 + if !exists("s:netrwbuf") + let s:netrwbuf= {} + endif + if has_key(s:netrwbuf,s:NetrwFullPath(dirname)) + let bufnum= s:netrwbuf[s:NetrwFullPath(dirname)] +" call Decho("lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnum) + if !bufexists(bufnum) + call remove(s:netrwbuf,s:NetrwFullPath(dirname)) + let bufnum= -1 endif - let bufnum= -1 -" call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist",'~'.expand("")) - else - " find buffer number of buffer named precisely the same as dirname {{{3 -" call Decho("case listtyle not treelist: find buffer numnber of buffer named precisely the same as dirname--",'~'.expand("")) -" call Dredir("(NetrwGetBuffer) ls!","ls!") - - " get dirname and associated buffer number - let bufnum = bufnr(escape(dirname,'\')) -" call Decho(" find buffer<".dirname.">'s number ",'~'.expand("")) -" call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum,'~'.expand("")) - - if bufnum < 0 && dirname !~ '/$' - " try appending a trailing / -" call Decho(" try appending a trailing / to dirname<".dirname.">",'~'.expand("")) - let bufnum= bufnr(escape(dirname.'/','\')) - if bufnum > 0 - let dirname= dirname.'/' - endif - endif - - if bufnum < 0 && dirname =~ '/$' - " try removing a trailing / -" call Decho(" try removing a trailing / from dirname<".dirname.">",'~'.expand("")) - let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\')) - if bufnum > 0 - let dirname= substitute(dirname,'/$','','') - endif - endif - -" call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)",'~'.expand("")) - " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches) - if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' - " handle approximate matches -" call Decho(" handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'",'~'.expand("")) - let ibuf = 1 - let buflast = bufnr("$") -" call Decho(" findbuf2: buflast=bufnr($)=".buflast,'~'.expand("")) - while ibuf <= buflast - let bname= substitute(bufname(ibuf),'\\','/','g') - let bname= substitute(bname,'.\zs/$','','') -" call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">",'~'.expand("")) - if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/' - " bname is not empty - " dirname ends with bname, - " dirname doesn't start with /, so its not a absolute path -" call Decho(" findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/','~'.expand("")) - break - endif - if bname =~ '^'.dirname.'/\=$' - " bname begins with dirname -" call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$','~'.expand("")) - break - endif - if dirname =~ '^'.bname.'/$' -" call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$','~'.expand("")) - break - endif - if bname != '' && dirname =~ '/'.bname.'$' && bname == bufname("%") && line("$") == 1 -" call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$','~'.expand("")) - break - endif - let ibuf= ibuf + 1 - endwhile - if ibuf > buflast - let bufnum= -1 - else - let bufnum= ibuf - endif -" call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")",'~'.expand("")) - endif +" call Decho("lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."] not a key") + let bufnum= -1 endif " get enew buffer and name it -or- re-use buffer {{{3 - if bufnum < 0 || !bufexists(bufnum) " get enew buffer and name it + if bufnum < 0 " get enew buffer and name it " call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)",'~'.expand("")) call s:NetrwEnew(dirname) " call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)",'~'.expand("")) @@ -4093,6 +4021,10 @@ fun! s:NetrwGetBuffer(islocal,dirname) " let v:errmsg= "" " Decho exe 'sil! keepj keepalt file '.escdirname " call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">",'~'.expand("")) + " enter the new buffer into the s:netrwbuf dictionary + let s:netrwbuf[s:NetrwFullPath(dirname)]= bufnr("%") +" call Decho("update netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnr("%"),'~'.expand("")) +" call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("")) endif " call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">",'~'.expand("")) @@ -4100,7 +4032,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)",'~'.expand("")) let eikeep= &ei setl ei=all - if getline(2) =~ '^" Netrw Directory Listing' + if getline(2) =~# '^" Netrw Directory Listing' " call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum,'~'.expand("")) exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum else @@ -4215,20 +4147,20 @@ fun! s:NetrwGetWord() let dirname= "./" let curline= getline('.') - if curline =~ '"\s*Sorted by\s' + if curline =~# '"\s*Sorted by\s' NetrwKeepj norm s let s:netrw_skipbrowse= 1 echo 'Pressing "s" also works' - elseif curline =~ '"\s*Sort sequence:' + elseif curline =~# '"\s*Sort sequence:' let s:netrw_skipbrowse= 1 echo 'Press "S" to edit sorting sequence' - elseif curline =~ '"\s*Quick Help:' + elseif curline =~# '"\s*Quick Help:' NetrwKeepj norm ? let s:netrw_skipbrowse= 1 - elseif curline =~ '"\s*\%(Hiding\|Showing\):' + elseif curline =~# '"\s*\%(Hiding\|Showing\):' NetrwKeepj norm a let s:netrw_skipbrowse= 1 echo 'Pressing "a" also works' @@ -4471,10 +4403,10 @@ fun! s:NetrwBookmark(del,...) let i = 1 while i <= a:0 if islocal - if v:version == 704 && has("patch656") - let mbfiles= glob(a:{i},0,1,1) + if v:version > 704 || (v:version == 704 && has("patch656")) + let mbfiles= glob(fnameescape(a:{i}),0,1,1) else - let mbfiles= glob(a:{i},0,1) + let mbfiles= glob(fnameescape(a:{i}),0,1) endif else let mbfiles= [a:{i}] @@ -4578,14 +4510,13 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Dret("s:NetrwBrowseChgDir") return endif +" call Decho("b:netrw_curdir<".b:netrw_curdir.">") " NetrwBrowseChgDir: save options and initialize {{{3 " call Decho("saving options",'~'.expand("")) + call s:SavePosn(s:netrw_nbcd) NetrwKeepj call s:NetrwOptionSave("s:") NetrwKeepj call s:NetrwSafeOptions() - let nbcd_curpos = winsaveview() -" call Decho("saving posn to nbcd_curpos<".string(nbcd_curpos).">",'~'.expand("")) - let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos if (has("win32") || has("win95") || has("win64") || has("win16")) let dirname = substitute(b:netrw_curdir,'\\','/','ge') else @@ -4601,15 +4532,14 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if g:netrw_banner " call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("")) if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt - if getline(".") =~ 'Quick Help' + if getline(".") =~# 'Quick Help' " call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) let g:netrw_quickhelp= (g:netrw_quickhelp + 1)%len(s:QuickHelp) " call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) setl ma noro nowrap NetrwKeepj call setline(line('.'),'" Quick Help: :help '.s:QuickHelp[g:netrw_quickhelp]) setl noma nomod nowrap -" call Decho("restoring posn to nbcd_curpos<".string(nbcd_curpos).">",'~'.expand("")) - NetrwKeepj call winrestview(nbcd_curpos) + call s:RestorePosn(s:netrw_nbcd) NetrwKeepj call s:NetrwOptionRestore("s:") " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) endif @@ -4633,7 +4563,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("adjusting dirname<".dirname.'> (put trailing "/" back)','~'.expand("")) endif -" " call Decho("[newdir<".newdir."> ".((newdir =~ dirpat)? "=~" : "!~")." dirpat<".dirpat.">] && [islocal=".a:islocal."] && [newdir is ".(isdirectory(s:NetrwFile(newdir))? "" : "not ")."a directory]",'~'.expand("")) +" call Decho("[newdir<".newdir."> ".((newdir =~ dirpat)? "=~" : "!~")." dirpat<".dirpat.">] && [islocal=".a:islocal."] && [newdir is ".(isdirectory(s:NetrwFile(newdir))? "" : "not ")."a directory]",'~'.expand("")) if newdir !~ dirpat && !(a:islocal && isdirectory(s:NetrwFile(s:ComposePath(dirname,newdir)))) " ------------------------------ " NetrwBrowseChgDir: edit a file {{{3 @@ -4658,7 +4588,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("edit-a-file: dirname<".dirname.">",'~'.expand("")) " call Decho("edit-a-file: tree listing",'~'.expand("")) elseif newdir =~ '^\(/\|\a:\)' -" call Decho("edit-a-file: handle an url or path starting with /: <".newdir.">") +" call Decho("edit-a-file: handle an url or path starting with /: <".newdir.">",'~'.expand("")) let dirname= newdir else let dirname= s:ComposePath(dirname,newdir) @@ -4685,7 +4615,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !&ea keepalt wincmd _ endif - call s:SetRexDir(a:islocal,b:netrw_curdir) + call s:SetRexDir(a:islocal,curdir) elseif g:netrw_browse_split == 2 " vertically splitting the window first " call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("")) @@ -4693,12 +4623,15 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !&ea keepalt wincmd | endif - call s:SetRexDir(a:islocal,b:netrw_curdir) + call s:SetRexDir(a:islocal,curdir) elseif g:netrw_browse_split == 3 " open file in new tab " call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("")) keepalt tabnew - call s:SetRexDir(a:islocal,b:netrw_curdir) + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + call s:SetRexDir(a:islocal,curdir) elseif g:netrw_browse_split == 4 " act like "P" (ie. open previous window) " call Decho("edit-a-file: use previous window for edit",'~'.expand("")) @@ -4707,7 +4640,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Dret("s:NetrwBrowseChgDir") return endif - call s:SetRexDir(a:islocal,b:netrw_curdir) + call s:SetRexDir(a:islocal,curdir) else " handling a file, didn't split, so remove menu " call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("")) @@ -4860,7 +4793,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif let treedir = s:NetrwTreeDir(a:islocal) " call Decho("tree-list: treedir<".treedir.">",'~'.expand("")) - let s:treecurpos = nbcd_curpos + let s:treecurpos = winsaveview() let haskey = 0 " call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">",'~'.expand("")) @@ -4936,6 +4869,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " else " Decho " call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod,'~'.expand("")) endif + call s:RestorePosn(s:netrw_nbcd) if dolockout && dorestore " call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname),'~'.expand("")) if filewritable(dirname) @@ -4971,6 +4905,10 @@ fun! s:NetrwBrowseUpDir(islocal) return endif + if !exists("w:netrw_liststyle") || w:netrw_liststyle != s:TREELIST + call s:SavePosn(s:netrw_nbcd) + endif + norm! 0 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " call Decho("case: treestyle",'~'.expand("")) @@ -5010,7 +4948,9 @@ fun! s:NetrwBrowseUpDir(islocal) else call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../')) endif - if exists("w:netrw_bannercnt") + if has_key(s:netrw_nbcd,bufnr("%")) + call s:RestorePosn(s:netrw_nbcd) + elseif exists("w:netrw_bannercnt") " call Decho("moving to line#".w:netrw_bannercnt,'~'.expand("")) exe w:netrw_bannercnt else @@ -5106,17 +5046,20 @@ fun! netrw#BrowseX(fname,remote) " call Decho("fname<".fname.">",'~'.expand("")) " call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("")) - " set up redirection - if &srr =~ "%s" - if (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= substitute(&srr,"%s","nul","") + " set up redirection (avoids browser messages) + " by default, g:netrw_suppress_gx_mesg is true + if g:netrw_suppress_gx_mesg + if &srr =~ "%s" + if (has("win32") || has("win95") || has("win64") || has("win16")) + let redir= substitute(&srr,"%s","nul","") + else + let redir= substitute(&srr,"%s","/dev/null","") + endif + elseif (has("win32") || has("win95") || has("win64") || has("win16")) + let redir= &srr . "nul" else - let redir= substitute(&srr,"%s","/dev/null","") + let redir= &srr . "/dev/null" endif - elseif (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= &srr . "nul" - else - let redir= &srr . "/dev/null" endif " call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("")) @@ -5377,8 +5320,12 @@ endfun " --------------------------------------------------------------------- " s:NetrwGlob: does glob() if local, remote listing otherwise {{{2 -fun! s:NetrwGlob(direntry,expr) -" call Dfunc("s:NetrwGlob(direntry<".a:direntry."> expr<".a:expr.">)") +" direntry: this is the name of the directory. Will be fnameescape'd to prevent wildcard handling by glob() +" expr : this is the expression to follow the directory. Will use s:ComposePath() +" pare =1: remove the current directory from the resulting glob() filelist +" =0: leave the current directory in the resulting glob() filelist +fun! s:NetrwGlob(direntry,expr,pare) +" call Dfunc("s:NetrwGlob(direntry<".a:direntry."> expr<".a:expr."> pare=".a:pare.")") if netrw#CheckIfRemote() keepalt 1sp keepalt enew @@ -5393,9 +5340,16 @@ fun! s:NetrwGlob(direntry,expr) let filelist= w:netrw_treedict[a:direntry] endif let w:netrw_liststyle= keep_liststyle + elseif v:version > 704 || (v:version == 704 && has("patch656")) + let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1,1) + if a:pare + let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') + endif else - let filelist= glob(s:ComposePath(a:direntry,a:expr),0,1,1) - let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') + let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1) + if a:pare + let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') + endif endif " call Dret("s:NetrwGlob ".string(filelist)) return filelist @@ -6087,7 +6041,7 @@ fun! s:NetrwMaps(islocal) nnoremap qf :call NetrwFileInfo(1,NetrwGetWord()) nnoremap qF :call NetrwMarkFileQFEL(1,getqflist()) nnoremap qL :call NetrwMarkFileQFEL(1,getloclist(v:count)) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) nnoremap s :call NetrwSortStyle(1) nnoremap S :call NetSortSequence(1) nnoremap Tb :call NetrwSetTgt(1,'b',v:count1) @@ -6140,7 +6094,7 @@ fun! s:NetrwMaps(islocal) " inoremap qf :call NetrwFileInfo(1,NetrwGetWord()) " inoremap qF :call NetrwMarkFileQFEL(1,getqflist()) " inoremap qL :call NetrwMarkFileQFEL(1,getloclist(v:count)) -" inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) +" inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) " inoremap s :call NetrwSortStyle(1) " inoremap S :call NetSortSequence(1) " inoremap t :call NetrwSplit(4) @@ -6261,7 +6215,7 @@ fun! s:NetrwMaps(islocal) nnoremap qf :call NetrwFileInfo(0,NetrwGetWord()) nnoremap qF :call NetrwMarkFileQFEL(0,getqflist()) nnoremap qL :call NetrwMarkFileQFEL(0,getloclist(v:count)) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) nnoremap s :call NetrwSortStyle(0) nnoremap S :call NetSortSequence(0) nnoremap Tb :call NetrwSetTgt(0,'b',v:count1) @@ -6311,7 +6265,7 @@ fun! s:NetrwMaps(islocal) " inoremap qf :call NetrwFileInfo(0,NetrwGetWord()) " inoremap qF :call NetrwMarkFileQFEL(0,getqflist()) " inoremap qL :call NetrwMarkFileQFEL(0,getloclist(v:count)) -" inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) +" inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) " inoremap s :call NetrwSortStyle(0) " inoremap S :call NetSortSequence(0) " inoremap t :call NetrwSplit(1) @@ -6415,10 +6369,10 @@ fun! s:NetrwMarkFiles(islocal,...) let i = 1 while i <= a:0 if a:islocal - if v:version == 704 && has("patch656") - let mffiles= glob(a:{i},0,1,1) + if v:version > 704 || (v:version == 704 && has("patch656")) + let mffiles= glob(fnameescape(a:{i}),0,1,1) else - let mffiles= glob(a:{i},0,1) + let mffiles= glob(fnameescape(a:{i}),0,1) endif else let mffiles= [a:{i}] @@ -6894,6 +6848,8 @@ fun! s:NetrwMarkFileCopy(islocal,...) " cleanup " ------- " call Decho("cleanup",'~'.expand("")) + " remove markings from local buffer + call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer " call Decho(" g:netrw_fastbrowse =".g:netrw_fastbrowse,'~'.expand("")) " call Decho(" s:netrwmftgt =".s:netrwmftgt,'~'.expand("")) " call Decho(" s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("")) @@ -7373,7 +7329,7 @@ fun! s:NetrwMarkFileGrep(islocal) if exists("nonisi") " original, user-supplied pattern did not begin with a character from isident " call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg",'~'.expand("")) - if pat =~ nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' + if pat =~# nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' call s:NetrwMarkFileQFEL(a:islocal,getqflist()) endif endif @@ -7571,7 +7527,7 @@ fun! s:NetrwMarkFileRegexp(islocal) " get the matching list of files using local glob() " call Decho("handle local regexp",'~'.expand("")) let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - if v:version == 704 && has("patch656") + if v:version > 704 || (v:version == 704 && has("patch656")) let files = glob(s:ComposePath(dirname,regexp),0,0,1) else let files = glob(s:ComposePath(dirname,regexp),0,0) @@ -7788,7 +7744,7 @@ fun! s:NetrwMarkFileTgt(islocal) " need to do refresh so that the banner will be updated " s:LocalBrowseRefresh handles all local-browsing buffers when not fast browsing if g:netrw_fastbrowse <= 1 -" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse.", so refreshing all local netrw buffers") +" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse.", so refreshing all local netrw buffers",'~'.expand("")) call s:LocalBrowseRefresh() endif " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) @@ -7821,10 +7777,10 @@ fun! s:NetrwGetCurdir(islocal) " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("")) endif -" call Decho("b:netrw_curdir<".b:netrw_curdir."> ".((b:netrw_curdir !~ '\<\a\{3,}://')? "does not match" : "matches")." url pattern") +" call Decho("b:netrw_curdir<".b:netrw_curdir."> ".((b:netrw_curdir !~ '\<\a\{3,}://')? "does not match" : "matches")." url pattern",'~'.expand("")) if b:netrw_curdir !~ '\<\a\{3,}://' let curdir= b:netrw_curdir -" call Decho("g:netrw_keepdir=".g:netrw_keepdir) +" call Decho("g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("")) if g:netrw_keepdir == 0 call s:NetrwLcd(curdir) endif @@ -8125,7 +8081,7 @@ fun! s:NetrwMenu(domenu) elseif !a:domenu let s:netrwcnt = 0 let curwin = winnr() - windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif + windo if getline(2) =~# "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif exe curwin."wincmd w" if s:netrwcnt <= 1 @@ -8708,7 +8664,7 @@ fun! s:NetrwSortStyle(islocal) let svpos= winsaveview() " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let g:netrw_sort_by= (g:netrw_sort_by =~ '^n')? 'time' : (g:netrw_sort_by =~ '^t')? 'size' : (g:netrw_sort_by =~ '^siz')? 'exten' : 'name' + let g:netrw_sort_by= (g:netrw_sort_by =~# '^n')? 'time' : (g:netrw_sort_by =~# '^t')? 'size' : (g:netrw_sort_by =~# '^siz')? 'exten' : 'name' NetrwKeepj norm! 0 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) @@ -8811,7 +8767,6 @@ fun! s:NetrwSplit(mode) let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) - "call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) unlet s:didsplit else @@ -8890,9 +8845,9 @@ endfun " (full path directory with trailing slash returned) fun! s:NetrwTreeDir(islocal) " call Dfunc("s:NetrwTreeDir(islocal=".a:islocal.") getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) -" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a')) -" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) -" call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a')) +" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("")) +" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("")) +" call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a'),'~'.expand("")) if exists("s:treedir") " s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early @@ -8933,7 +8888,7 @@ fun! s:NetrwTreeDir(islocal) " detect user attempting to close treeroot " call Decho("check if user is attempting to close treeroot",'~'.expand("")) " call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) -" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~ '^'.s:treedepthstring)? '=~' : '!~').' ^'.s:treedepthstring,'~'.expand("")) +" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~# '^'.s:treedepthstring)? '=~#' : '!~').' ^'.s:treedepthstring,'~'.expand("")) if curline !~ '^'.s:treedepthstring && getline('.') != '..' " call Decho(".user may have attempted to close treeroot",'~'.expand("")) " now force a refresh @@ -9040,24 +8995,24 @@ fun! s:NetrwRefreshTreeDict(dir) if entry =~ '/$' && has_key(w:netrw_treedict,direntry) " call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("")) NetrwKeepj call s:NetrwRefreshTreeDict(direntry) - let liststar = s:NetrwGlob(direntry,'*') - let listdotstar = s:NetrwGlob(direntry,'.*') + let liststar = s:NetrwGlob(direntry,'*',1) + let listdotstar = s:NetrwGlob(direntry,'.*',1) let w:netrw_treedict[direntry] = liststar + listdotstar " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("")) elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') " call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("")) NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/') - let liststar = s:NetrwGlob(direntry.'/','*') - let listdotstar= s:NetrwGlob(direntry.'/','.*') + let liststar = s:NetrwGlob(direntry.'/','*',1) + let listdotstar= s:NetrwGlob(direntry.'/','.*',1) let w:netrw_treedict[direntry]= liststar + listdotstar " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("")) elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@') " call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("")) NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/') - let liststar = s:NetrwGlob(direntry.'/','*') - let listdotstar= s:NetrwGlob(direntry.'/','.*') + let liststar = s:NetrwGlob(direntry.'/','*',1) + let listdotstar= s:NetrwGlob(direntry.'/','.*',1) " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("")) else @@ -9315,14 +9270,14 @@ fun! s:PerformListing(islocal) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) let sortby= g:netrw_sort_by - if g:netrw_sort_direction =~ "^r" + if g:netrw_sort_direction =~# "^r" let sortby= sortby." reversed" endif " Sorted by... {{{3 if g:netrw_banner " call Decho("--handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("")) - if g:netrw_sort_by =~ "^n" + if g:netrw_sort_by =~# "^n" " call Decho("directories will be sorted by name",'~'.expand("")) " sorted by name NetrwKeepj put ='\" Sorted by '.sortby @@ -9419,13 +9374,13 @@ fun! s:PerformListing(islocal) if !g:netrw_banner || line("$") >= w:netrw_bannercnt " call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("")) - if g:netrw_sort_by =~ "^n" + if g:netrw_sort_by =~# "^n" " sort by name NetrwKeepj call s:NetrwSetSort() if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - if g:netrw_sort_direction =~ 'n' + if g:netrw_sort_direction =~# 'n' " normal direction sorting exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else @@ -9438,7 +9393,7 @@ fun! s:PerformListing(islocal) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' NetrwKeepj call histdel("/",-1) - elseif g:netrw_sort_by =~ "^ext" + elseif g:netrw_sort_by =~# "^ext" " sort by extension exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g+/+s/^/001'.g:netrw_sepchr.'/' NetrwKeepj call histdel("/",-1) @@ -9448,7 +9403,7 @@ fun! s:PerformListing(islocal) NetrwKeepj call histdel("/",-1) if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - if g:netrw_sort_direction =~ 'n' + if g:netrw_sort_direction =~# 'n' " normal direction sorting exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else @@ -9462,7 +9417,7 @@ fun! s:PerformListing(islocal) elseif a:islocal if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction,'~'.expand("")) - if g:netrw_sort_direction =~ 'n' + if g:netrw_sort_direction =~# 'n' " call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort','~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else @@ -9474,7 +9429,7 @@ fun! s:PerformListing(islocal) endif endif - elseif g:netrw_sort_direction =~ 'r' + elseif g:netrw_sort_direction =~# 'r' " call Decho('(s:PerformListing) reverse the sorted listing','~'.expand("")) if !g:netrw_banner || w:netrw_bannercnt < line('$') exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt @@ -9790,9 +9745,9 @@ fun! s:NetrwRemoteListing() " call Decho("use ftp to get remote file listing",'~'.expand("")) let s:method = "ftp" let listcmd = g:netrw_ftp_list_cmd - if g:netrw_sort_by =~ '^t' + if g:netrw_sort_by =~# '^t' let listcmd= g:netrw_ftp_timelist_cmd - elseif g:netrw_sort_by =~ '^s' + elseif g:netrw_sort_by =~# '^s' let listcmd= g:netrw_ftp_sizelist_cmd endif " call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)",'~'.expand("")) @@ -9899,7 +9854,7 @@ fun! s:NetrwRemoteListing() if s:method == "ftp" " cleanup exe "sil! NetrwKeepj ".w:netrw_bannercnt - while getline('.') =~ g:netrw_ftp_browse_reject + while getline('.') =~# g:netrw_ftp_browse_reject sil! NetrwKeepj d endwhile " if there's no ../ listed, then put ../ in @@ -9952,9 +9907,9 @@ fun! s:NetrwRemoteRm(usrhost,path) range " call Decho("remove all marked files with bufnr#".bufnr("%"),'~'.expand("")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwRemoteRmFile(a:path,fname,all) - if ok =~ 'q\%[uit]' + if ok =~# 'q\%[uit]' break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif endfor @@ -9973,9 +9928,9 @@ fun! s:NetrwRemoteRm(usrhost,path) range while ctr <= a:lastline exe "NetrwKeepj ".ctr let ok= s:NetrwRemoteRmFile(a:path,s:NetrwGetWord(),all) - if ok =~ 'q\%[uit]' + if ok =~# 'q\%[uit]' break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif let ctr= ctr + 1 @@ -10014,12 +9969,12 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) let ok="no" endif let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" " call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : ""),'~'.expand("")) if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) " call Decho("case ftp:",'~'.expand("")) @@ -10054,13 +10009,13 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) else call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif - else if ret != 0 + elseif ret != 0 call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif " call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("")) endif endif - elseif ok =~ 'q\%[uit]' + elseif ok =~# 'q\%[uit]' " call Decho("ok==".ok,'~'.expand("")) endif @@ -10075,12 +10030,12 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) let ok="no" endif let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) else @@ -10103,7 +10058,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) endif endif - elseif ok =~ 'q\%[uit]' + elseif ok =~# 'q\%[uit]' " call Decho("ok==".ok,'~'.expand("")) endif endif @@ -10257,7 +10212,7 @@ fun! netrw#LocalBrowseCheck(dirname) " would hit when re-entering netrw windows, creating unexpected " refreshes (and would do so in the middle of NetrwSaveOptions(), too) " call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">") -" call Decho("isdir<".a:dirname.">=".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).expand("")) +" call Decho("isdir<".a:dirname."> =".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).'~'.expand("")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) " call Dredir("ls!","ls!") " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) @@ -10281,7 +10236,6 @@ fun! netrw#LocalBrowseCheck(dirname) unlet s:treeforceredraw sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) endif - " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) " call Dret("netrw#LocalBrowseCheck") return @@ -10361,7 +10315,7 @@ fun! s:LocalBrowseRefresh() " refresh any netrw buffer " call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf),'~'.expand("")) exe bufwinnr(ibuf)."wincmd w" - if getline(".") =~ 'Quick Help' + if getline(".") =~# 'Quick Help' " decrement g:netrw_quickhelp to prevent refresh from changing g:netrw_quickhelp " (counteracts s:NetrwBrowseChgDir()'s incrementing) let g:netrw_quickhelp= g:netrw_quickhelp - 1 @@ -10467,15 +10421,8 @@ fun! s:LocalListing() " get the list of files contained in the current directory let dirname = b:netrw_curdir let dirnamelen = strlen(b:netrw_curdir) - if v:version == 704 && has("patch656") -" call Decho("using glob with patch656",'~'.expand("")) - let filelist = glob(s:ComposePath(dirname,"*"),0,1,1) - let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1,1) - else -" call Decho("using glob without patch656",'~'.expand("")) - let filelist = glob(s:ComposePath(dirname,"*"),0,1) - let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) - endif + let filelist = s:NetrwGlob(dirname,"*",0) + let filelist = filelist + s:NetrwGlob(dirname,".*",0) " call Decho("filelist=".string(filelist),'~'.expand("")) if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16")) @@ -10487,9 +10434,9 @@ fun! s:LocalListing() " call Decho("filelist=".string(filelist),'~'.expand("")) endif -" call Decho("before while: dirname<".dirname.">",'~'.expand("")) +" call Decho("before while: dirname <".dirname.">",'~'.expand("")) " call Decho("before while: dirnamelen<".dirnamelen.">",'~'.expand("")) -" call Decho("before while: filelist=".string(filelist),'~'.expand("")) +" call Decho("before while: filelist =".string(filelist),'~'.expand("")) if get(g:, 'netrw_dynamic_maxfilenamelen', 0) let filelistcopy = map(deepcopy(filelist),'fnamemodify(v:val, ":t")') @@ -10559,15 +10506,15 @@ fun! s:LocalListing() if w:netrw_liststyle == s:LONGLIST let sz = getfsize(filename) - if g:netrw_sizestyle =~ "[hH]" + if g:netrw_sizestyle =~# "[hH]" let sz= s:NetrwHumanReadable(sz) endif let fsz = strpart(" ",1,15-strlen(sz)).sz let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) -" call Decho("sz=".sz." fsz=".fsz,'~'.expand("")) +" call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("")) endif - if g:netrw_sort_by =~ "^t" + if g:netrw_sort_by =~# "^t" " sort by time (handles time up to 1 quintillion seconds, US) " call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("")) let t = getftime(filename) @@ -10580,7 +10527,7 @@ fun! s:LocalListing() " sort by size (handles file sizes up to 1 quintillion bytes, US) " call Decho("getfsize(".filename.")=".getfsize(filename),'~'.expand("")) let sz = getfsize(filename) - if g:netrw_sizestyle =~ "[hH]" + if g:netrw_sizestyle =~# "[hH]" let sz= s:NetrwHumanReadable(sz) endif let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz @@ -10733,9 +10680,9 @@ fun! s:NetrwLocalRm(path) range " call Decho("remove all marked files",'~'.expand("")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwLocalRmFile(a:path,fname,all) - if ok =~ 'q\%[uit]' || ok == "no" + if ok =~# 'q\%[uit]' || ok == "no" break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif endfor @@ -10762,9 +10709,9 @@ fun! s:NetrwLocalRm(path) range continue endif let ok= s:NetrwLocalRmFile(a:path,curword,all) - if ok =~ 'q\%[uit]' || ok == "no" + if ok =~# 'q\%[uit]' || ok == "no" break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif let ctr= ctr + 1 @@ -10811,12 +10758,12 @@ fun! s:NetrwLocalRmFile(path,fname,all) " call Decho("response: ok<".ok.">",'~'.expand("")) let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') " call Decho("response: ok<".ok."> (after sub)",'~'.expand("")) - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" let ret= s:NetrwDelete(rmfile) " call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("")) endif @@ -10832,13 +10779,13 @@ fun! s:NetrwLocalRmFile(path,fname,all) if ok == "" let ok="no" endif - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif let rmfile= substitute(rmfile,'[\/]$','','e') - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" if v:version < 704 || !has("patch1109") " " call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.s:ShellEscape(rmfile).')','~'.expand("")) call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile)) @@ -10878,6 +10825,17 @@ endfun " --------------------------------------------------------------------- " Support Functions: {{{1 +" --------------------------------------------------------------------- +" s:WinNames: COMBAK {{{2 +fun! s:WinNames(id) + let curwin= winnr() + 1wincmd w +" call Decho("--- Windows By Name --- #".a:id) +" windo call Decho("win#".winnr()."<".expand("%").">") +" call Decho("--- --- --- --- --- ---") + exe curwin."wincmd w" +endfun + " --------------------------------------------------------------------- " netrw#Access: intended to provide access to variable values for netrw's test suite {{{2 " 0: marked file list of current buffer @@ -10905,8 +10863,6 @@ fun! netrw#Call(funcname,...) " call Dret("netrw#Call") endfun -" ------------------------------------------------------------------------ - " --------------------------------------------------------------------- " netrw#Expose: allows UserMaps and pchk to look at otherwise script-local variables {{{2 " I expect this function to be used in @@ -10914,18 +10870,22 @@ endfun " for example. fun! netrw#Expose(varname) " call Dfunc("netrw#Expose(varname<".a:varname.">)") - exe "let retval= s:".a:varname - if exists("g:netrw_pchk") - if type(retval) == 3 - let retval = copy(retval) - let i = 0 - while i < len(retval) - let retval[i]= substitute(retval[i],expand("$HOME"),'~','') - let i = i + 1 - endwhile + if exists("s:".a:varname) + exe "let retval= s:".a:varname + if exists("g:netrw_pchk") + if type(retval) == 3 + let retval = copy(retval) + let i = 0 + while i < len(retval) + let retval[i]= substitute(retval[i],expand("$HOME"),'~','') + let i = i + 1 + endwhile + endif +" call Dret("netrw#Expose ".string(retval)) + return string(retval) endif -" call Dret("netrw#Expose ".string(retval)) - return string(retval) + else + let retval= "n/a" endif " call Dret("netrw#Expose ".string(retval)) @@ -11018,9 +10978,9 @@ fun! s:ComposePath(base,subdir) " call Decho("amiga",'~'.expand("")) let ec = a:base[s:Strlen(a:base)-1] if ec != '/' && ec != ':' - let ret = a:base . "/" . a:subdir + let ret = a:base."/" . a:subdir else - let ret = a:base . a:subdir + let ret = a:base.a:subdir endif elseif a:subdir =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) @@ -11248,10 +11208,10 @@ fun! s:NetrwBMShow() redir END let bmshowlist = split(bmshowraw,'\n') if bmshowlist != [] - let bmshowfuncs= filter(bmshowlist,'v:val =~ "\\d\\+_BMShow()"') + let bmshowfuncs= filter(bmshowlist,'v:val =~# "\\d\\+_BMShow()"') if bmshowfuncs != [] let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','') - if bmshowfunc =~ '^call.*BMShow()' + if bmshowfunc =~# '^call.*BMShow()' exe "sil! NetrwKeepj ".bmshowfunc endif endif @@ -11395,11 +11355,12 @@ fun! s:NetrwEnew(...) " call Decho("generate a buffer with NetrwKeepj keepalt enew!",'~'.expand("")) " when tree listing uses file TreeListing... a new buffer is made. " Want the old buffer to be unlisted. - setl nobl + " COMBAK: this causes a problem, see P43 +" setl nobl let netrw_keepdiff= &l:diff noswapfile NetrwKeepj keepalt enew! let &l:diff= netrw_keepdiff -" call Decho("bufnr($)=".bufnr("$")." winnr($)=".winnr("$"),'~'.expand("")) +" call Decho("bufnr($)=".bufnr("$")."<".bufname(bufnr("$"))."> winnr($)=".winnr("$"),'~'.expand("")) NetrwKeepj call s:NetrwOptionSave("w:") " copy function-local-variables to buffer variable equivalents @@ -11458,8 +11419,8 @@ endfun " --------------------------------------------------------------------- " s:NetrwInsureWinVars: insure that a netrw buffer has its w: variables in spite of a wincmd v or s {{{2 fun! s:NetrwInsureWinVars() -" call Dfunc("s:NetrwInsureWinVars() win#".winnr()) if !exists("w:netrw_liststyle") +" call Dfunc("s:NetrwInsureWinVars() win#".winnr()) let curbuf = bufnr("%") let curwin = winnr() let iwin = 1 @@ -11479,8 +11440,8 @@ fun! s:NetrwInsureWinVars() let w:{k}= winvars[k] endfor endif +" call Dret("s:NetrwInsureWinVars win#".winnr()) endif -" call Dret("s:NetrwInsureWinVars win#".winnr()) endfun " --------------------------------------------------------------------- @@ -11685,7 +11646,7 @@ endfun " s:SetRexDir() sets up <2-leftmouse> maps (if g:netrw_retmap " is true) and a command, :Rexplore, which call this function. " -" s:nbcd_curpos_{bufnr('%')} is set up by s:NetrwBrowseChgDir() +" s:netrw_nbcd is set up by s:NetrwBrowseChgDir() " " s:rexposn_BUFNR used to save/restore cursor position fun! s:NetrwRexplore(islocal,dirname) @@ -11765,6 +11726,29 @@ fun! s:SaveBufVars() " call Dret("s:SaveBufVars") endfun +" --------------------------------------------------------------------- +" s:SavePosn: saves position associated with current buffer into a dictionary {{{2 +fun! s:SavePosn(posndict) +" call Dfunc("s:SavePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") + + let a:posndict[bufnr("%")]= winsaveview() +" call Decho("saving posn: posndict[".bufnr("%")."]=".string(winsaveview()),'~'.expand("")) + +" call Dret("s:SavePosn posndict") + return a:posndict +endfun + +" --------------------------------------------------------------------- +" s:RestorePosn: restores position associated with current buffer using dictionary {{{2 +fun! s:RestorePosn(posndict) +" call Dfunc("s:RestorePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") + if has_key(a:posndict,bufnr("%")) + call winrestview(a:posndict[bufnr("%")]) +" call Decho("restoring posn: posndict[".bufnr("%")."]=".string(a:posndict[bufnr("%")]),'~'.expand("")) + endif +" call Dret("s:RestorePosn") +endfun + " --------------------------------------------------------------------- " s:SaveWinVars: (used by Explore() and NetrwSplit()) {{{2 fun! s:SaveWinVars() @@ -11819,10 +11803,10 @@ fun! s:SetRexDir(islocal,dirname) let w:netrw_rexdir = a:dirname let w:netrw_rexlocal = a:islocal let s:rexposn_{bufnr("%")} = winsaveview() -" call Decho("setting w:netrw_rexdir =".w:netrw_rexdir) -" call Decho("setting w:netrw_rexlocal=".w:netrw_rexlocal) +" call Decho("setting w:netrw_rexdir =".w:netrw_rexdir,'~'.expand("")) +" call Decho("setting w:netrw_rexlocal=".w:netrw_rexlocal,'~'.expand("")) " call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("")) -" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("")) +" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to ".string(winsaveview()),'~'.expand("")) " call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) endfun @@ -11956,7 +11940,7 @@ fun! s:TreeListMove(dir) " call Decho("regfile srch back: ".nl,'~'.expand("")) elseif a:dir == '[]' && nxtline != '' NetrwKeepj norm! 0 -" call Decho('srchpat<'.'^\%('.curindent.'\)\@!'.'>') +" call Decho('srchpat<'.'^\%('.curindent.'\)\@!'.'>','~'.expand("")) let nl = search('^\%('.curindent.'\)\@!','We') " search forwards if nl != 0 NetrwKeepj norm! k diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index dea70a362f..c3978fa3d6 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.4. Last change: 2016 Mar 26 +*autocmd.txt* For Vim version 7.4. Last change: 2016 Apr 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -539,6 +539,9 @@ CursorHold When the user doesn't press a key for the time versions} *CursorHoldI* CursorHoldI Just like CursorHold, but in Insert mode. + Not triggered when waiting for another key, + e.g. after CTRL-V, and not when in CTRL-X mode + |insert_expand|. *CursorMoved* CursorMoved After the cursor was moved in Normal or Visual diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 2280f65063..02f3139b38 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.4. Last change: 2016 Mar 08 +*change.txt* For Vim version 7.4. Last change: 2016 Apr 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -852,7 +852,7 @@ Examples: > :s/abcde/abc^Mde/ modifies "abcde" to "abc", "de" (two lines) :s/$/\^M/ modifies "abcde" to "abcde^M" :s/\w\+/\u\0/g modifies "bla bla" to "Bla Bla" - :s/\w\+/\L\u/g modifies "BLA bla" to "Bla Bla" + :s/\w\+/\L\u\0/g modifies "BLA bla" to "Bla Bla" Note: "\L\u" can be used to capitalize the first letter of a word. This is not compatible with Vi and older versions of Vim, where the "\u" would cancel @@ -1205,7 +1205,7 @@ name '"'. This means you have to type two double quotes. Writing to the "" register writes to register "0. {Vi: register contents are lost when changing files, no '"'} -2. Numbered registers "0 to "9 *quote_number* *quote0* *quote1* +2. Numbered registers "0 to "9 *quote_number* *quote0* *quote1* *quote2* *quote3* *quote4* *quote9* Vim fills these registers with text from yank and delete commands. Numbered register 0 contains the text from the most recent yank command, diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt index cc4bc904ae..e91a403563 100644 --- a/runtime/doc/channel.txt +++ b/runtime/doc/channel.txt @@ -200,10 +200,10 @@ Note that a channel is closed in three stages: 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* +*E898* *E901* *E902* If there is an error reading or writing a channel it will be closed. -*E896* *E630* *E631* +*E630* *E631* ============================================================================== 4. Using a JSON or JS channel *channel-use* diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index d9ce12a8a5..3610a0e1b1 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1221,7 +1221,7 @@ Examples: > If you want to always use ":confirm", set the 'confirm' option. - *:browse* *:bro* *E338* *E614* *E615* *E616* *E578* + *:browse* *:bro* *E338* *E614* *E615* *E616* :bro[wse] {command} Open a file selection dialog for an argument to {command}. At present this works for |:e|, |:w|, |:wall|, |:wq|, |:wqall|, |:x|, |:xall|, |:exit|, diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 2d7beb7c26..3e9985843b 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2016 Apr 14 +*eval.txt* For Vim version 7.4. Last change: 2016 Apr 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -752,7 +752,7 @@ A |Dictionary| can only be compared with a |Dictionary| and only "equal", "not equal" and "is" can be used. This compares the key/values of the |Dictionary| recursively. Ignoring case means case is ignored when comparing item values. - *E693* *E694* + *E694* A |Funcref| can only be compared with a |Funcref| and only "equal" and "not equal" can be used. Case is never ignored. Whether arguments or a Dictionary are bound (with a partial) is ignored. This is so that when a function is @@ -2127,14 +2127,17 @@ sqrt({expr}) Float square root of {expr} str2float({expr}) Float convert String to Float str2nr({expr} [, {base}]) Number convert String to Number strchars({expr} [, {skipcc}]) Number character length of the String {expr} +strcharpart({str}, {start}[, {len}]) + String {len} characters of {str} at {start} strdisplaywidth({expr} [, {col}]) Number display length of the String {expr} strftime({format}[, {time}]) String time in specified format +strgetchar({str}, {index}) Number get char {index} from {str} stridx({haystack}, {needle}[, {start}]) Number index of {needle} in {haystack} string({expr}) String String representation of {expr} value strlen({expr}) Number length of the String {expr} -strpart({src}, {start}[, {len}]) - String {len} characters of {src} at {start} +strpart({str}, {start}[, {len}]) + String {len} characters of {str} at {start} strridx({haystack}, {needle} [, {start}]) Number last index of {needle} in {haystack} strtrans({expr}) String translate string to make it printable @@ -2551,7 +2554,9 @@ byteidx({expr}, {nr}) *byteidx()* same: > let s = strpart(str, byteidx(str, 3)) echo strpart(s, 0, byteidx(s, 1)) -< If there are less than {nr} characters -1 is returned. +< Also see |strgetchar()| and |strcharpart()|. + + If there are less than {nr} characters -1 is returned. If there are exactly {nr} characters the length of the string in bytes is returned. @@ -3418,6 +3423,10 @@ feedkeys({string} [, {mode}]) *feedkeys()* will behave as if is typed, to avoid getting stuck, waiting for a character to be typed before the script continues. + '!' When used with 'x' will not end Insert mode. Can be + used in a test when a timer is set to exit Insert mode + a little later. Useful for testing CursorHoldI. + Return value is always 0. filereadable({file}) *filereadable()* @@ -4100,16 +4109,21 @@ getreg([{regname} [, 1 [, {list}]]]) *getreg()* The result is a String, which is the contents of register {regname}. Example: > :let cliptext = getreg('*') -< getreg('=') returns the last evaluated value of the expression +< When {regname} was not set the result is a empty string. + + getreg('=') returns the last evaluated value of the expression register. (For use in maps.) getreg('=', 1) returns the expression itself, so that it can be restored with |setreg()|. For other registers the extra argument is ignored, thus you can always give it. - If {list} is present and non-zero result type is changed to - |List|. Each list item is one text line. Use it if you care + + If {list} is present and non-zero, the result type is changed + to |List|. Each list item is one text line. Use it if you care about zero bytes possibly present inside register: without third argument both NLs and zero bytes are represented as NLs (see |NL-used-for-Nul|). + When the register was not set an empty list is returned. + If {regname} is not specified, |v:register| is used. @@ -5590,7 +5604,6 @@ pumvisible() *pumvisible()* This can be used to avoid some things that would remove the popup menu. - *E860* py3eval({expr}) *py3eval()* Evaluate Python expression {expr} and return its result converted to Vim data structures. @@ -6652,7 +6665,6 @@ strchars({expr} [, {skipcc}]) *strchars()* counted separately. When {skipcc} set to 1, Composing characters are ignored. Also see |strlen()|, |strdisplaywidth()| and |strwidth()|. - {skipcc} is only available after 7.4.755. For backward compatibility, you can define a wrapper function: > @@ -6670,6 +6682,13 @@ strchars({expr} [, {skipcc}]) *strchars()* endfunction endif < +strcharpart({src}, {start}[, {len}]) *strcharpart()* + Like |strpart()| but using character index and length instead + of byte index and length. + When a character index is used where a character does not + exist it is assumed to be one byte. For example: > + strcharpart('abc', -1, 2) +< results in 'a'. strdisplaywidth({expr}[, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells @@ -6703,6 +6722,12 @@ strftime({format} [, {time}]) *strftime()* < Not available on all systems. To check use: > :if exists("*strftime") +strgetchar({str}, {index}) *strgetchar()* + Get character {index} from {str}. This uses a character + index, not a byte index. Composing characters are considered + separate characters here. + Also see |strcharpart()| and |strchars()|. + stridx({haystack}, {needle} [, {start}]) *stridx()* The result is a Number, which gives the byte index in {haystack} of the first occurrence of the String {needle}. @@ -6752,14 +6777,17 @@ strlen({expr}) The result is a Number, which is the length of the String strpart({src}, {start}[, {len}]) *strpart()* The result is a String, which is part of {src}, starting from byte {start}, with the byte length {len}. - When non-existing bytes are included, this doesn't result in - an error, the bytes are simply omitted. + To count characters instead of bytes use |strcharpart()|. + + When bytes are selected which do not exist, this doesn't + result in an error, the bytes are simply omitted. If {len} is missing, the copy continues from {start} till the end of the {src}. > strpart("abcdefg", 3, 2) == "de" strpart("abcdefg", -2, 4) == "ab" strpart("abcdefg", 5, 4) == "fg" strpart("abcdefg", 3) == "defg" + < Note: To get the first character, {start} must be 0. For example, to get three bytes under and after the cursor: > strpart(getline("."), col(".") - 1, 3) @@ -8422,14 +8450,6 @@ This does NOT work: > endfor < Note that reordering the list (e.g., with sort() or reverse()) may have unexpected effects. - Note that the type of each list item should be - identical to avoid errors for the type of {var} - changing. Unlet the variable at the end of the loop - to allow multiple item types: > - for item in ["foo", ["bar"]] - echo item - unlet item " E706 without this - endfor :for [{var1}, {var2}, ...] in {listlist} :endfo[r] diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index d8dc48f066..695b24adb5 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -97,8 +97,8 @@ command does the same and also splits the window (short: "scs"). The available subcommands are: - *E563* *E564* *E566* *E568* *E569* *E622* *E623* - *E625* *E626* *E609* + *E563* *E564* *E566* *E568* *E622* *E623* *E625* + *E626* *E609* add : Add a new cscope database/connection. USAGE :cs add {file|dir} [pre-path] [flags] diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index 3d91814b4f..cec23dbecb 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -734,7 +734,7 @@ if the `:py3` command is working: > :py3 print("Hello") < *:py3file* The `:py3file` command works similar to `:pyfile`. - *:py3do* *E863* + *:py3do* The `:py3do` command works similar to `:pydo`. diff --git a/runtime/doc/if_tcl.txt b/runtime/doc/if_tcl.txt index a7a61df4e5..685c3c29cd 100644 --- a/runtime/doc/if_tcl.txt +++ b/runtime/doc/if_tcl.txt @@ -16,7 +16,7 @@ The Tcl Interface to Vim *tcl* *Tcl* *TCL* 8. Examples |tcl-examples| 9. Dynamic loading |tcl-dynamic| -{Vi does not have any of these commands} *E280* *E281* +{Vi does not have any of these commands} *E280* The Tcl interface only works when Vim was compiled with the |+tcl| feature. diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 76ff93ffba..c636b7cb31 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.4. Last change: 2016 Mar 12 +*index.txt* For Vim version 7.4. Last change: 2016 Apr 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -49,6 +49,7 @@ tag char action in Insert mode ~ |i_CTRL-G_k| CTRL-G k line up, to column where inserting started |i_CTRL-G_k| CTRL-G line up, to column where inserting started |i_CTRL-G_u| CTRL-G u start new undoable edit +|i_CTRL-G_U| CTRL-G U don't break undo with next cursor movement |i_| delete character before the cursor |i_digraph| {char1}{char2} enter digraph (only when 'digraph' option set) @@ -859,6 +860,7 @@ tag command note action in Visual mode ~ ------------------------------------------------------------------------------ |v_CTRL-\_CTRL-N| CTRL-\ CTRL-N stop Visual mode |v_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode' +|v_CTRL-A| CTRL-A 2 add N to number in highlighted text |v_CTRL-C| CTRL-C stop Visual mode |v_CTRL-G| CTRL-G toggle between Visual mode and Select mode |v_| 2 Select mode: delete highlighted area @@ -867,6 +869,7 @@ tag command note action in Visual mode ~ command |v_CTRL-V| CTRL-V make Visual mode blockwise or stop Visual mode +|v_CTRL-X| CTRL-X 2 subtract N from number in highlighted text |v_| stop Visual mode |v_CTRL-]| CTRL-] jump to highlighted tag |v_!| !{filter} 2 filter the highlighted lines through the @@ -923,6 +926,8 @@ tag command note action in Visual mode ~ |v_a}| a} same as aB |v_c| c 2 delete highlighted area and start insert |v_d| d 2 delete highlighted area +|v_g_CTRL-A| g CTRL-A 2 add N to number in highlighted text +|v_g_CTRL-X| g CTRL-X 2 subtract N from number in highlighted text |v_gJ| gJ 2 join the highlighted lines without inserting spaces |v_gq| gq 2 format the highlighted lines diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 4e7a784fab..3fd22f6ae0 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1358,7 +1358,7 @@ Possible attributes are: Note that -range=N and -count=N are mutually exclusive - only one should be specified. - *E889* *:command-addr* + *:command-addr* It is possible that the special characters in the range like ., $ or % which by default correspond to the current line, last line and the whole buffer, relate to arguments, (loaded) buffers, windows or tab pages. diff --git a/runtime/doc/netbeans.txt b/runtime/doc/netbeans.txt index 74bdc346f7..7455f2f3d6 100644 --- a/runtime/doc/netbeans.txt +++ b/runtime/doc/netbeans.txt @@ -827,7 +827,7 @@ REJECT Not used. These errors occur when a message violates the protocol: *E627* *E628* *E629* *E632* *E633* *E634* *E635* *E636* *E637* *E638* *E639* *E640* *E641* *E642* *E643* *E644* *E645* *E646* -*E647* *E648* *E649* *E650* *E651* *E652* *E653* *E654* +*E647* *E648* *E649* *E650* *E651* *E652* ============================================================================== diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index b354ddf584..80d2360937 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2016 Apr 12 +*options.txt* For Vim version 7.4. Last change: 2016 Apr 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4863,6 +4863,7 @@ A jump table for the options with a short description can be found at |Q_op|. feature} Specifies the name of the Lua shared library. The default is DYNAMIC_LUA_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -5030,7 +5031,7 @@ A jump table for the options with a short description can be found at |Q_op|. without a limit. On 64 bit machines higher values might work. But hey, do you really need more than 2 Gbyte for text editing? Keep in mind that text is - stored in the swap file, one can edit files > 2 Gbyte anyay. We do + stored in the swap file, one can edit files > 2 Gbyte anyway. We do need the memory to store undo info. Also see 'maxmem'. @@ -5590,6 +5591,7 @@ A jump table for the options with a short description can be found at |Q_op|. feature} Specifies the name of the Perl shared library. The default is DYNAMIC_PERL_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -5727,6 +5729,7 @@ A jump table for the options with a short description can be found at |Q_op|. feature} Specifies the name of the Python 2.x shared library. The default is DYNAMIC_PYTHON_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -5738,6 +5741,7 @@ A jump table for the options with a short description can be found at |Q_op|. feature} Specifies the name of the Python 3 shared library. The default is DYNAMIC_PYTHON3_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -5968,6 +5972,7 @@ A jump table for the options with a short description can be found at |Q_op|. feature} Specifies the name of the Ruby shared library. The default is DYNAMIC_RUBY_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -7462,6 +7467,7 @@ A jump table for the options with a short description can be found at |Q_op|. feature} Specifies the name of the Tcl shared library. The default is DYNAMIC_TCL_DLL, which was specified at compile time. + Environment variables are expanded |:set_env|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 9cb6e11860..e77c1c2688 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -576,7 +576,7 @@ An atom can be followed by an indication of how many times the atom can be matched and in what way. This is called a multi. See |/multi| for an overview. - */star* */\star* *E56* + */star* */\star* * (use \* when 'magic' is not set) Matches 0 or more of the preceding atom, as many as possible. Example 'nomagic' matches ~ @@ -596,7 +596,7 @@ overview. the end of the file and then tries matching "END", backing up one character at a time. - */\+* *E57* + */\+* \+ Matches 1 or more of the preceding atom, as many as possible. {not in Vi} Example matches ~ @@ -612,7 +612,7 @@ overview. \? Just like \=. Cannot be used when searching backwards with the "?" command. {not in Vi} - */\{* *E58* *E60* *E554* *E870* + */\{* *E60* *E554* *E870* \{n,m} Matches n to m of the preceding atom, as many as possible \{n} Matches n of the preceding atom \{n,} Matches at least n of the preceding atom, as many as possible diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 145c918443..3f705d4ba1 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.4. Last change: 2016 Feb 16 +*pi_netrw.txt* For Vim version 7.4. Last change: 2016 Apr 20 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -1525,6 +1525,7 @@ the |'isfname'| option (which is global, so netrw doesn't modify it). Associated setting variables: |g:netrw_gx| control how gx picks up the text under the cursor |g:netrw_nogx| prevent gx map while editing + |g:netrw_suppress_gx_mesg| controls gx's suppression of browser messages *netrw_filehandler* @@ -2931,6 +2932,13 @@ your browsing preferences. (see also: |netrw-settings|) such as listing, file removal, etc. default: ssh + *g:netrw_suppress_gx_mesg* =1 : browsers sometimes produce messages + which are normally unwanted intermixed + with the page. + However, when using links, for example, + those messages are what the browser produces. + By setting this option to 0, netrw will not + suppress browser messages. *g:netrw_tmpfile_escape* =' &;' escape() is applied to all temporary files @@ -3757,6 +3765,23 @@ netrw: ============================================================================== 12. History *netrw-history* {{{1 + v156: Feb 18, 2016 * Changed =~ to =~# where appropriate + Feb 23, 2016 * s:ComposePath(base,subdir) now uses + fnameescape() on the base portion + Mar 01, 2016 * (gt_macki) reported where :Explore would + make file unlisted. Fixed (tst943) + Apr 04, 2016 * (reported by John Little) netrw normally + suppresses browser messages, but sometimes + those "messages" are what is wanted. + See |g:netrw_suppress_gx_mesg| + Apr 06, 2016 * (reported by Carlos Pita) deleting a remote + file was giving an error message. Fixed. + Apr 08, 2016 * (Charles Cooper) had a problem with an + undefined b:netrw_curdir. He also provided + a fix. + Apr 20, 2016 * Changed s:NetrwGetBuffer(); now uses + dictionaries. Also fixed the "No Name" + buffer problem. v155: Oct 29, 2015 * (Timur Fayzrakhmanov) reported that netrw's mapping of ctrl-l was not allowing refresh of other windows when it was done in a netrw diff --git a/runtime/doc/tags b/runtime/doc/tags index ec0e58083a..1a221ac5f4 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -3551,6 +3551,7 @@ CTRL-] tagsrch.txt /*CTRL-]* CTRL-^ editing.txt /*CTRL-^* CTRL-{char} intro.txt /*CTRL-{char}* Channel eval.txt /*Channel* +Channels eval.txt /*Channels* Chinese mbyte.txt /*Chinese* Cmd-event autocmd.txt /*Cmd-event* CmdUndefined autocmd.txt /*CmdUndefined* @@ -3769,7 +3770,6 @@ E273 if_ruby.txt /*E273* E277 remote.txt /*E277* E28 syntax.txt /*E28* E280 if_tcl.txt /*E280* -E281 if_tcl.txt /*E281* E282 starting.txt /*E282* E283 motion.txt /*E283* E284 mbyte.txt /*E284* @@ -3854,7 +3854,6 @@ E358 options.txt /*E358* E359 term.txt /*E359* E36 windows.txt /*E36* E360 various.txt /*E360* -E362 term.txt /*E362* E363 options.txt /*E363* E364 eval.txt /*E364* E365 print.txt /*E365* @@ -4062,7 +4061,6 @@ E556 tagsrch.txt /*E556* E557 term.txt /*E557* E558 term.txt /*E558* E559 term.txt /*E559* -E56 pattern.txt /*E56* E560 if_cscop.txt /*E560* E561 if_cscop.txt /*E561* E562 if_cscop.txt /*E562* @@ -4071,8 +4069,6 @@ E564 if_cscop.txt /*E564* E566 if_cscop.txt /*E566* E567 if_cscop.txt /*E567* E568 if_cscop.txt /*E568* -E569 if_cscop.txt /*E569* -E57 pattern.txt /*E57* E570 message.txt /*E570* E571 if_tcl.txt /*E571* E572 if_tcl.txt /*E572* @@ -4081,9 +4077,7 @@ E574 starting.txt /*E574* E575 starting.txt /*E575* E576 starting.txt /*E576* E577 starting.txt /*E577* -E578 editing.txt /*E578* E579 eval.txt /*E579* -E58 pattern.txt /*E58* E580 eval.txt /*E580* E581 eval.txt /*E581* E582 eval.txt /*E582* @@ -4162,8 +4156,6 @@ E65 pattern.txt /*E65* E650 netbeans.txt /*E650* E651 netbeans.txt /*E651* E652 netbeans.txt /*E652* -E653 netbeans.txt /*E653* -E654 netbeans.txt /*E654* E655 eval.txt /*E655* E656 netbeans.txt /*E656* E657 netbeans.txt /*E657* @@ -4206,7 +4198,6 @@ E69 pattern.txt /*E69* E690 eval.txt /*E690* E691 eval.txt /*E691* E692 eval.txt /*E692* -E693 eval.txt /*E693* E694 eval.txt /*E694* E695 eval.txt /*E695* E696 eval.txt /*E696* @@ -4387,9 +4378,7 @@ E855 autocmd.txt /*E855* E858 eval.txt /*E858* E859 eval.txt /*E859* E86 windows.txt /*E86* -E860 eval.txt /*E860* E862 eval.txt /*E862* -E863 if_pyth.txt /*E863* E864 pattern.txt /*E864* E865 pattern.txt /*E865* E866 pattern.txt /*E866* @@ -4417,7 +4406,6 @@ E885 sign.txt /*E885* E886 starting.txt /*E886* E887 if_pyth.txt /*E887* E888 pattern.txt /*E888* -E889 map.txt /*E889* E89 message.txt /*E89* E890 syntax.txt /*E890* E891 eval.txt /*E891* @@ -4425,11 +4413,8 @@ E892 eval.txt /*E892* E893 eval.txt /*E893* E894 eval.txt /*E894* E895 if_mzsch.txt /*E895* -E896 channel.txt /*E896* E898 channel.txt /*E898* -E899 channel.txt /*E899* E90 message.txt /*E90* -E900 channel.txt /*E900* E901 channel.txt /*E901* E902 channel.txt /*E902* E903 channel.txt /*E903* @@ -4527,6 +4512,7 @@ InsertLeave autocmd.txt /*InsertLeave* J change.txt /*J* Japanese mbyte.txt /*Japanese* Job eval.txt /*Job* +Jobs eval.txt /*Jobs* K various.txt /*K* KDE gui_x11.txt /*KDE* KVim gui_x11.txt /*KVim* @@ -6356,6 +6342,7 @@ g` motion.txt /*g`* g`a motion.txt /*g`a* ga various.txt /*ga* garbagecollect() eval.txt /*garbagecollect()* +garbagecollect_for_testing() eval.txt /*garbagecollect_for_testing()* gd pattern.txt /*gd* gdb debug.txt /*gdb* ge motion.txt /*ge* @@ -8260,11 +8247,13 @@ statusmsg-variable eval.txt /*statusmsg-variable* str2float() eval.txt /*str2float()* str2nr() eval.txt /*str2nr()* strcasestr() eval.txt /*strcasestr()* +strcharpart() eval.txt /*strcharpart()* strchars() eval.txt /*strchars()* strchr() eval.txt /*strchr()* strcspn() eval.txt /*strcspn()* strdisplaywidth() eval.txt /*strdisplaywidth()* strftime() eval.txt /*strftime()* +strgetchar() eval.txt /*strgetchar()* stridx() eval.txt /*stridx()* string eval.txt /*string* string() eval.txt /*string()* @@ -8609,6 +8598,7 @@ terminal-options term.txt /*terminal-options* terminfo term.txt /*terminfo* termresponse-variable eval.txt /*termresponse-variable* test-functions usr_41.txt /*test-functions* +testing-variable eval.txt /*testing-variable* tex-cchar syntax.txt /*tex-cchar* tex-cole syntax.txt /*tex-cole* tex-conceal syntax.txt /*tex-conceal* @@ -8805,6 +8795,7 @@ v:swapchoice eval.txt /*v:swapchoice* v:swapcommand eval.txt /*v:swapcommand* v:swapname eval.txt /*v:swapname* v:termresponse eval.txt /*v:termresponse* +v:testing eval.txt /*v:testing* v:this_session eval.txt /*v:this_session* v:throwpoint eval.txt /*v:throwpoint* v:true eval.txt /*v:true* diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index a56813ac0e..4359764fdc 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -542,7 +542,7 @@ correct values. One command can be used to set the screen size: - *:mod* *:mode* *E359* *E362* + *:mod* *:mode* *E359* :mod[e] [mode] Without argument this only detects the screen size and redraws the screen. diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index ff359b1680..8b0329c9a4 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2016 Apr 11 +*todo.txt* For Vim version 7.4. Last change: 2016 Apr 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,26 +34,19 @@ not be repeated below, unless there is extra information. *known-bugs* -------------------- Known bugs and current work ----------------------- -Crash in garbagecollect() after starting a job. (Yasuhiro Matsumoto) - :let g:a = job_start(['ls']) - :call garbagecollect() --> Need to find a way to call garbagecollect() in a test. - -Channel closes unexpectedly. (Christian Robinson, 2016 Apr 10) -Log file later. -Remarks from Kazunobu Kuriyama. Fix from Hirohito, suggested by Ozaki Kiichi. - -When test_partial start_job() has a non-existing command memory leaks. - -Vim 8 features to mention: -* TabNew, TabNewEntered and TabClosed autocommand events. - -Also keep a list of loaded plugins, skip when encountered again? +In test_partial when start_job() has a non-existing command memory leaks. Memory leak in test49 Memory leak in test_alot, with matchstrpos() +Also keep a list of loaded plugins, skip when encountered again? + +Vim.org: when a user already has a homepage, do show the field so that it can +be deleted. + +channel: +- GUI:cursor blinking is irregular when invoking callbacks. (Ramel Eshed, 2016 + Apr 16) somehow remember the previous state? - When a message in the queue but there is no callback, drop it after a while? Add timestamp to queued messages and callbacks with ID, remove after a minute. Option to set the droptime. @@ -67,17 +60,10 @@ Later - job_start(): run job in a newly opened terminal. With xterm could use -S{pty}. -Test for try/catch in 'tabline'. #746, Haya, 2016 Apr 10. - Make it so that the window ID can be used where currently a window nr is used -Patch to make tag jump work on function({expr}). (Hirohito Higashi, 2016 Mar -25) - -Patch to improve I/O for Perl. (Damien, 2016 Jan 9, update Jan 22 2nd one) - -Add strgetchar(): get a character by index from a string. - using [] is a byte index. +Patch to fix invalid behavior with NULL list. (Nikolai Pavlov, #768) +Also check :for. Regexp problems: - The regexp engines are not reentrant, causing havoc when interrupted by a @@ -124,26 +110,23 @@ Regexp problems: Using freed memory in quickfix code. (Dominique, 2016 Mar 21) -Patch 7.4.1401 caused autochdir not to work on startup. (Rob Hoelz, #704) +jsonencode(): should convert to utf-8. (Nikolai Pavlov, 2016 Jan 23) +What if there is an invalid character? -Patch to support partions for Python, #734. Nikolai Pavlov, 2017 Apr 6 +Once .exe with updated installer is available: Add remark to download page +about /S and /D options (Ken Takata, 2016 Apr 13) -Patch to fix that folds close with autocomplete. #643 -Christian Brabandt, 2016 Feb 18. +Patch to make cursor blinking work better with GTK3. (Kazunobu Kuriyama, 2016 +Apr 19) Need to check this works on Linux. -Also include update_curswant() fix for getcurpos(). (Christian Brabandt, 2016 -Feb 9) - -When cross-compiling skip generating the tags file (and moving it out of the -way). (Christian Neukirchen, 2016 Apr 7) #740 - -Patch to list some messages and clear messages. (Yasuhiro Matsumoto, 2016 Mar -12) +Use ADDR_OTHER instead of ADDR_LINES for many more commands. +Add tests for using number larger than number of lines in buffer. Patch to fix escaping special characters for delete(). (tc-0, 2016 Mar 20, #700) Test fails on MS-Windows. -Patch to have complete() not set 'modified'. (Shougo, 2016 Apr 9, #745) +ml_get errors when reloading file. (Chris Desjardins, 2016 Apr 19) +Also with latest version. Patch to put undo options together in undo window. (Gary Johnson, 2016 Jan 28) @@ -151,9 +134,11 @@ Patch to put undo options together in undo window. Still problems with 'emoji'. See issue #721. Patch 7.4.1697 half-fixes it. Avoid PLAN_WRITE in windgoto() ? +AVR assembler syntax file. (Marius Ghita, #439) + Patch to have better check for {action} argument of setqflist(). Nikolai Pavlov, Feb 25, #661. Can be even more strict. -Also see patch from Hirohito Higash, Feb 25. +Also see patch from Hirohito Higashi, Feb 25. Updated patch, 2016 Mar 25. Patch to update the GTK icon cache when installing. (Kazunobu Kuriyama, 2016 @@ -163,13 +148,22 @@ Patch for test86 and test87. (Roland Puntaier, #622) Cannot delete a file with square brackets with delete(). (#696) +Patch to add GUI colors to the terminal, when 'guicolors' is set. (ZyX, 2013 +Jan 26, update 2013 Dec 14, another 2014 Nov 22) + +Patch to add TabNew, TabNewEntered and TabClosed autocommand events. +(Felipe Morales, 2015 Feb 1) + Patch on issue #728 by Christian Brabandt, 2016 Apr 7. Update with test: Apr 8. +Explanation Apr 12. Might be related to: Test 44 fails when [[=A=]] is changed to [[=À=]]. Caused by getcmdline() not handling the 0x80 as a second byte correctly? (Dominique Pelle, 2015 Jun 10) Patch to add 'topbot' to 'belloff' option. (Coot, 2016 Mar 18, #695) +Patch for C syntax HL. (Bradley Garagan, 2016 Apr 17) #763 + Patch to make matchit work better, respect 'matchpairs'. (Ken Takata, 2016 Mar 25) @@ -196,6 +190,9 @@ Update 2016 Apr 4. Patch to add the :bvimgrep command. (Christian Brabandt, 2014 Nov 12) Updated 2016 Feb 10 +Neovim patch for utfc_ptr2char_len() https://github.com/neovim/neovim/pull/4574 +No test, needs some work to include. +> Patch to improve indenting for C++ constructor with initializer list. (Hirohito Higashi, 2016 Mar 31) @@ -228,8 +225,13 @@ Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) Patch to make tests pass with EBCDIC. (Owen Leibman, 2016 Apr 10) -jsonencode(): should convert to utf-8. (Nikolai Pavlov, 2016 Jan 23) -What if there is an invalid character? +When repeating the 'confirm' dialog one needs to press Enter. (ds26gte, 2016 +Apr 17) #762 + +Patch to support expression argument to sort() instead of a function name. +Yasuhiro Matsumoto, 2013 May 31. +Or should we add a more general mechanism, like a lambda() function? +Patch by Yasuhiro Matsumoto, 2014 Sep 16, update 2016 Apr 17. Should jsonencode()/jsondecode() restrict recursiveness? Or avoid recursiveness. @@ -266,7 +268,7 @@ directory exists. (Sergio Gallelli, 2013 Dec 29) Patch by Christian Brabandt, 2016 Feb 1. Patch to discard remainder of long error messages in quickfix, avoid using -them as separate messages. (Anton Lindqvist, 2016 Apr 9) +them as separate messages. (Anton Lindqvist, 2016 Apr 9, update Apr 13) Patch to avoid redrawing tabline when the popup menu is visible. (Christian Brabandt, 2016 Jan 28) @@ -279,6 +281,10 @@ Patch from Christian Brabandt, 2016 Mar 30, #712. Patch to be able to use hex numbers with :digraph. (Lcd, 2015 Sep 6) Update Sep 7. Update by Christian Brabandt, 2015 Sep 8, 2016 Feb 1. +When the CursorMovedI event triggers, and CTRL-X was typed, a script cannot +restore the mode properly. (Andrew Stewart, 2016 Apr 20) +Do not trigger the event? + Using ":windo" to set options in all windows has the side effect that it changes the window layout and the current window. Make a variant that saves and restores. Use in the matchparen plugin. @@ -297,7 +303,7 @@ https://gist.github.com/presuku/d3d6b230b9b6dcfc0477 Patch to make the behavior of "w" more straightforward, but not Vi compatible. With a 'cpo' flag. (Christian Brabandt, 2016 Feb 8) -Patch to add optionproperties(). (Anton Lindqvist, 2016 Mar 27) +Patch to add optionproperties(). (Anton Lindqvist, 2016 Mar 27, update Apr 13) Patch to add TagNotFound autocommand. (Anton Lindqvist, 2016 Feb 3) @@ -374,9 +380,6 @@ is Vi compatible, the completion fails. (Hirohito Higashi, 2015 Feb 19) Patch to use two highlight groups for relative numbers. (Shaun Brady, 2016 Jan 30) -Weird encryption problems on Windows. (Ben Fritz, 2015 Feb 13) -Goes away when disabling the swap file. (might1, Feb 16) - MS-Windows: Crash opening very long file name starting with "\\". (Christian Brock, 2012 Jun 29) @@ -405,9 +408,6 @@ Crash in :cnext on MS-Windows. (Ben Fritz, 2015 Oct 27) When using --remote-tab on MS-Windows 'encoding' hasn't been initialized yet, the file name ends up encoded wrong. (Raul Coronado, 2015 Dec 21) -Patch to add GUI colors to the terminal, when 'guicolors' is set. (ZyX, 2013 -Jan 26, update 2013 Dec 14, another 2014 Nov 22) - Patch for problem with restoring screen on Windows. (Nobuhiro Takasaki, 2015 Sep 10) @@ -428,8 +428,6 @@ Patch to fix checking global option value when not using it. When 'showbreak' is set repeating a Visual operation counts the size of the 'showbreak' text as part of the operation. (Axel Bender, 2015 Jul 20) -Patch for matchit plugin related to multibyte chars. (Ken Takata, 2015 Jul 22) - Patch for multi-byte characters in langmap and applying a mapping on them. (Christian Brabandt, 2015 Jun 12, update July 25) Is this the right solution? Need to cleanup langmap behavior: @@ -609,9 +607,6 @@ What for systems that don't have unsetenv()? Patch to add a :domodeline command. (Christian Brabandt, 2014 Oct 21) -Patch to add TabNew, TabNewEntered and TabClosed autocommand events. -(Felipe Morales, 2015 Feb 1) - This does not give an error: (Andre Sihera, 2014 Mar 21) vim -u NONE 1 2 3 -c 'bufdo if 1 | echo 1' This neither: (ZyX) @@ -678,14 +673,6 @@ various other commands. (ZyX, 2014 Mar 30) Patch to skip sort if no line matches the expression. (Christian Brabandt, 2014 Jun 25) -Patch to add sortuniq(). (Cade Forester, 2014 Mar 19) -Or add uniq() instead? Patch by lcd47, but it has problems. - -Patch to support expression argument to sort() instead of a function name. -Yasuhiro Matsumoto, 2013 May 31. -Or should we add a more general mechanism, like a lambda() function? -Patch by Yasuhiro Matsumoto, 2014 Sep 16. - VMS: Select() doesn't work properly, typing ESC may hang Vim. Use sys$qiow instead. (Samuel Ferencik, 2013 Sep 28) diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt index 8d14a870f7..b9df287627 100644 --- a/runtime/doc/version8.txt +++ b/runtime/doc/version8.txt @@ -1,4 +1,4 @@ -*version8.txt* For Vim version 8.0. Last change: 2016 Apr 12 +*version8.txt* For Vim version 8.0. Last change: 2016 Apr 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -37,8 +37,10 @@ INCOMPATIBLE CHANGES *incompatible-8* These changes are incompatible with previous releases. Check this list if you run into a problem when upgrading from Vim 7.4 to 8.0. -The support for MS-DOS has been removed. +The support for MS-DOS has been removed. It hasn't been working for a while +and removing it cleans up the code quite a bit. +The support for Windows 16 bit (Windows 95 and older) has been removed. Minor incompatibilities: @@ -47,13 +49,13 @@ For filetype detection: ... ============================================================================== NEW FEATURES *new-8* -First a list to the bigger new features. A comprehensive list is below. +First a list of the bigger new features. A comprehensive list is below. Asynchronous I/O support, channels ~ -Vim can now exchange messages with another process in the background. The -message are received and handled while Vim is waiting for a character. See +Vim can now exchange messages with another process in the background. The +messages are received and handled while Vim is waiting for a character. See |channel-demo| for an example, communicating with a Python server. Closely related to channels is JSON support. JSON is widely supported and can @@ -74,7 +76,7 @@ Timers ~ Also asynchronous are timers. They can fire once or repeatedly and invoke a function to do any work. For example: > let tempTimer = timer_start(4000, 'CheckTemp') -This will make call 4 seconds later, like: > +This will make a call four seconds (4000 milli seconds) later, like: > call CheckTemp() @@ -85,13 +87,13 @@ to a function, and additionally binds arguments and/or a dictionary. This is especially useful for callbacks on channels and timers. E.g., for the timer example above, to pass an argument to the function: > let tempTimer = timer_start(4000, function('CheckTemp', ['out'])) -This will make call 4 seconds later, like: > +This will a make call four seconds later, like: > call CheckTemp('out') Packages ~ -Plugins keep growing and more of them are available then ever before. To keep +Plugins keep growing and more of them are available than ever before. To keep the collection of plugins manageable package support has been added. This is a convenient way to get one or more plugins, drop them in a directory and possibly keep them updated. Vim will load them automatically, or only when @@ -145,7 +147,7 @@ works quite well, mostly just like GTK+ 2. Vim script enhancements *new-vim-script-8* ----------------------- -In Vim scripts the following types have been added: +In Vim script the following types have been added: |Special| |v:false|, |v:true|, |v:none| and |v:null| |Channel| connection to another process for asynchronous I/O diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 31b76b8c0c..7ec7df849e 100644 --- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Vim script " Maintainer: Bram Moolenaar -" Last Change: 2016 Jan 24 +" Last Change: 2016 Apr 19 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -60,7 +60,7 @@ function GetVimIndentIntern() else let ind = ind + shiftwidth() * 3 endif - elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+END' + elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+[eE][nN][dD]' let ind = ind + shiftwidth() else " A line starting with :au does not increment/decrement indent. diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index 69902b1f19..28e1c3ecf8 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -20,7 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v155" +let g:loaded_netrwPlugin = "v156" let s:keepcpo = &cpo set cpo&vim "DechoRemOn diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index 94d1b0b6b8..83d72c56ff 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: php PHP 3/4/5 " Maintainer: Jason Woofenden -" Last Change: Dec 26, 2015 +" Last Change: Apr 18, 2016 " URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD " Former Maintainers: Peter Hodge " Debian VIM Maintainers @@ -136,7 +136,7 @@ syn keyword phpConstant __LINE__ __FILE__ __FUNCTION__ __METHOD__ __CLASS__ __D " Function and Methods ripped from php_manual_de.tar.gz Jan 2003 syn keyword phpFunctions apache_child_terminate apache_get_modules apache_get_version apache_getenv apache_lookup_uri apache_note apache_request_headers apache_response_headers apache_setenv ascii2ebcdic ebcdic2ascii getallheaders virtual contained -syn keyword phpFunctions array_change_key_case array_chunk array_combine array_count_values array_diff_assoc array_diff_uassoc array_diff array_fill array_filter array_flip array_intersect_assoc array_intersect array_key_exists array_keys array_map array_merge_recursive array_merge array_multisort array_pad array_pop array_push array_rand array_reduce array_reverse array_search array_shift array_slice array_splice array_sum array_udiff_assoc array_udiff_uassoc array_udiff array_unique array_unshift array_values array_walk array arsort asort compact count current each end extract in_array key krsort ksort list natcasesort natsort next pos prev range reset rsort shuffle sizeof sort uasort uksort usort contained +syn keyword phpFunctions array_change_key_case array_chunk array_column array_combine array_count_values array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_diff array_fill_keys array_fill array_filter array_flip array_intersect_assoc array_intersect_key array_intersect_uassoc array_intersect_ukey array_intersect array_key_exists array_keys array_map array_merge_recursive array_merge array_multisort array_pad array_pop array_product array_push array_rand array_reduce array_replace_recursive array_replace array_reverse array_search array_shift array_slice array_splice array_sum array_udiff_assoc array_udiff_uassoc array_udiff array_uintersect_assoc array_uintersect_uassoc array_uintersect array_unique array_unshift array_values array_walk_recursive array_walk arsort asort count current each end in_array key_exists key krsort ksort natcasesort natsort next pos prev range reset rsort shuffle sizeof sort uasort uksort usort contained syn keyword phpFunctions aspell_check aspell_new aspell_suggest contained syn keyword phpFunctions bcadd bccomp bcdiv bcmod bcmul bcpow bcpowmod bcscale bcsqrt bcsub contained syn keyword phpFunctions bzclose bzcompress bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite contained From 8ed43916dbea4ccedcc84d271e292abbf658b9c5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 08:56:12 +0200 Subject: [PATCH 02/11] patch 7.4.1761 Problem: Coverity complains about ignoring return value. Solution: Add "(void)" to get rid of the warning. --- src/eval.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index 53a651a4d9..1daf042e18 100644 --- a/src/eval.c +++ b/src/eval.c @@ -13178,7 +13178,7 @@ f_getreg(typval_T *argvars, typval_T *rettv) rettv->vval.v_list = (list_T *)get_reg_contents(regname, (arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST); if (rettv->vval.v_list == NULL) - rettv_list_alloc(rettv); + (void)rettv_list_alloc(rettv); else ++rettv->vval.v_list->lv_refcount; } diff --git a/src/version.c b/src/version.c index eeff8c6f5d..63dedd72de 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1761, /**/ 1760, /**/ From 268a06ce901d2c780304e0395028e3c2f60ec755 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 09:07:01 +0200 Subject: [PATCH 03/11] patch 7.4.1762 Problem: Coverity: useless assignments. Solution: Remove them. --- src/search.c | 3 +-- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/search.c b/src/search.c index 23cb2911ed..5fc6820320 100644 --- a/src/search.c +++ b/src/search.c @@ -4594,7 +4594,6 @@ current_search( orig_pos = curwin->w_cursor; pos = curwin->w_cursor; - start_pos = VIsual; /* make sure, searching further will extend the match */ if (VIsual_active) @@ -4606,7 +4605,7 @@ current_search( } } else - orig_pos = pos = start_pos = curwin->w_cursor; + orig_pos = pos = curwin->w_cursor; /* Is the pattern is zero-width? */ one_char = is_one_char(spats[last_idx].pat, TRUE); diff --git a/src/version.c b/src/version.c index 63dedd72de..9cbce20b94 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1762, /**/ 1761, /**/ From ba53435144f46eaaa53c63a62e748b3feee9742c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 09:20:26 +0200 Subject: [PATCH 04/11] patch 7.4.1763 Problem: Coverity: useless assignment. Solution: Add #if 0. --- src/spell.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/spell.c b/src/spell.c index 3f23bf9927..259f6d7df2 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1649,7 +1649,9 @@ find_word(matchinf_T *mip, int mode) } } #endif +#if 0 /* Disabled, see below */ c = mip->mi_compoff; +#endif ++mip->mi_complen; if (flags & WF_COMPROOT) ++mip->mi_compextra; diff --git a/src/version.c b/src/version.c index 9cbce20b94..9ec96b2cc1 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1763, /**/ 1762, /**/ From 4694a17d1ec08382f996990a7fac1ac60197ec81 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 14:05:23 +0200 Subject: [PATCH 05/11] patch 7.4.1765 Problem: Undo options are not together in the options window. Solution: Put them together. (Gary Johnson) --- runtime/optwin.vim | 8 ++++---- src/os_unix.c | 7 +++++-- src/version.c | 4 ++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 368eb09dd6..b88f3017c1 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -738,6 +738,10 @@ call Header("editing text") call append("$", "undolevels\tmaximum number of changes that can be undone") call append("$", "\t(global or local to buffer)") call append("$", " \tset ul=" . &ul) +call append("$", "undofile\tautomatically save and restore undo history") +call BinOptionG("udf", &udf) +call append("$", "undodir\tlist of directories for undo files") +call OptionG("udir", &udir) call append("$", "undoreload\tmaximum number lines to save for undo on a buffer reload") call append("$", " \tset ur=" . &ur) call append("$", "modified\tchanges have been made and not written to a file") @@ -1074,10 +1078,6 @@ if has("vertsplit") call append("$", "cmdwinheight\theight of the command-line window") call OptionG("cwh", &cwh) endif -call append("$", "undofile\tautomatically save and restore undo history") -call BinOptionG("udf", &udf) -call append("$", "undodir\tlist of directories for undo files") -call OptionG("udir", &udir) call Header("executing external commands") diff --git a/src/os_unix.c b/src/os_unix.c index f8cf691d1f..57eb050660 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5138,7 +5138,8 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) if (pid == 0) { - int null_fd = -1; + int null_fd = -1; + int stderr_works = TRUE; /* child */ reset_signals(); /* handle signals normally */ @@ -5175,6 +5176,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) { close(2); ignored = dup(null_fd); + stderr_works = FALSE; } else if (use_out_for_err) { @@ -5210,7 +5212,8 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) /* See above for type of argv. */ execvp(argv[0], argv); - // perror("executing job failed"); + if (stderr_works) + perror("executing job failed"); _exit(EXEC_FAILED); /* exec failed, return failure code */ } diff --git a/src/version.c b/src/version.c index 9ec96b2cc1..75d4746920 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,10 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1765, +/**/ + 1764, /**/ 1763, /**/ From 02cfac85b4e4b038bb2df6962699fa93a42c7eb1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 14:34:58 +0200 Subject: [PATCH 06/11] patch 7.4.1766 Problem: Building instructions for MS-Windows are outdated. Solution: Mention setting SDK_INCLUDE_DIR. (Ben Franklin, closes #771) Move outdated instructions further down. --- src/INSTALLpc.txt | 139 ++++++++++++++++++++++++++-------------------- src/version.c | 2 + 2 files changed, 81 insertions(+), 60 deletions(-) diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt index 31da97dc49..bc1fa36e04 100644 --- a/src/INSTALLpc.txt +++ b/src/INSTALLpc.txt @@ -11,9 +11,9 @@ The file "feature.h" can be edited to match your preferences. You can skip this, then you will get the default behavior as is documented, which should be fine for most people. -With the exception of two sections (Windows 3.1 and MS-DOS), this document -assumes that you are building Vim for Win32 or later. -(Windows 95/98/Me/NT/2000/XP/2003/Vista/7/8/10) +This document assumes that you are building Vim for Win32 or later (Windows +XP/2003/Vista/7/8/10). There are also instructions for pre-XP systems, but +they might no longer work. Contents: @@ -36,9 +36,7 @@ Contents: The currently preferred method is using the free Visual C++ Toolkit 2008 -|msvc-2008-express|, the produced binary runs on most MS-Windows systems. If -you need the executable to run on Windows 98 or ME, use the 2003 one -|msvc-2003-toolkit|. +|msvc-2008-express|, the produced binary runs on most MS-Windows systems. 1. Microsoft Visual C++ @@ -87,6 +85,69 @@ These files have been supplied by George V. Reilly, Ben Singer, Ken Scott and Ron Aaron; they have been tested. +Visual C++ 2008 Express Edition *msvc-2008-express* +------------------------------- + +Visual C++ 2008 Express Edition can be downloaded for free from: + http://www.microsoft.com/express/downloads/ +This includes the IDE and the debugger. + +To set the environment execute the msvc2008.bat script. You can then build +Vim with Make_mvc.mak. + +For building 64 bit binaries you also need to install the SDK: +"Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1" +You don't need the examples and documentation. + +If you get an error that Win32.mak can't be found, you have to set the +variable SDK_INCLUDE_DIR. For example, on Windows 10, installation of MSVC +puts include files in the following directory: + set SDK_INCLUDE_DIR=C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include + + +Visual C++ 2010 Express Edition *msvc-2010-express* +------------------------------- + +Visual C++ 2010 Express Edition can be downloaded for free from: + http://www.microsoft.com/express/vc/Default.aspx +This includes the IDE and the debugger. + +To set the environment execute the msvc2010.bat script. You can then build +Vim with Make_mvc.mak. + + +Targeting Windows XP with new MSVC *new-msvc-windows-xp* +---------------------------------- + +Beginning with Visual C++ 2012, Microsoft changed the behavior of LINK.EXE +so that it targets Windows 6.0 (Vista) by default. In order to override +this, the target Windows version number needs to be passed to LINK like +follows: + LINK ... /subsystem:console,5.01 + +Make_mvc.mak now supports a macro SUBSYSTEM_VER to pass the Windows version. +Use lines like follows to target Windows XP (assuming using Visual C++ 2012 +under 64-bit Windows): + set WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A + set SDK_INCLUDE_DIR=%WinSdk71%\Include + set INCLUDE=%WinSdk71%\Include;%INCLUDE% + set LIB=%WinSdk71%\Lib;%LIB% + set PATH=%WinSdk71%\Bin;%PATH% + set CL=/D_USING_V110_SDK71_ + nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.01 + +The following Visual C++ team blog can serve as a reference page: + http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx + + +OLDER VERSIONS + +The minimal supported version is Windows XP. Building with older compilers +might still work, but these instructions might be outdated. + +If you need the executable to run on Windows 98 or ME, use the 2003 one +|msvc-2003-toolkit|. + Visual C++ Toolkit 2003 *msvc-2003-toolkit* ----------------------- @@ -172,55 +233,6 @@ Instructions for integrating the Platform SDK into VC Express: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx -Visual C++ 2008 Express Edition *msvc-2008-express* -------------------------------- - -Visual C++ 2008 Express Edition can be downloaded for free from: - http://www.microsoft.com/express/downloads/ -This includes the IDE and the debugger. - -To set the environment execute the msvc2008.bat script. You can then build -Vim with Make_mvc.mak. - -For building 64 bit binaries you also need to install the SDK: -"Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1" -You don't need the examples and documentation. - - -Visual C++ 2010 Express Edition *msvc-2010-express* -------------------------------- - -Visual C++ 2010 Express Edition can be downloaded for free from: - http://www.microsoft.com/express/vc/Default.aspx -This includes the IDE and the debugger. - -To set the environment execute the msvc2010.bat script. You can then build -Vim with Make_mvc.mak. - - -Targeting Windows XP with new MSVC *new-msvc-windows-xp* ----------------------------------- - -Beginning with Visual C++ 2012, Microsoft changed the behavior of LINK.EXE -so that it targets Windows 6.0 (Vista) by default. In order to override -this, the target Windows version number needs to be passed to LINK like -follows: - LINK ... /subsystem:console,5.01 - -Make_mvc.mak now supports a macro SUBSYSTEM_VER to pass the Windows version. -Use lines like follows to target Windows XP (assuming using Visual C++ 2012 -under 64-bit Windows): - set WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A - set SDK_INCLUDE_DIR=%WinSdk71%\Include - set INCLUDE=%WinSdk71%\Include;%INCLUDE% - set LIB=%WinSdk71%\Lib;%LIB% - set PATH=%WinSdk71%\Bin;%PATH% - set CL=/D_USING_V110_SDK71_ - nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.01 - -The following Visual C++ team blog can serve as a reference page: - http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx - 2. MinGW ======== @@ -253,10 +265,14 @@ System, Advanced, and edit the environment from there. If you use msys2 compilers, set your installed paths: C:\msys2\mingw32\bin +or + C:\msys64\mingw32\bin for 32bit. And 64bit: C:\msys2\mingw64\bin +or + C:\msys64\mingw64\bin Test if gcc is on your path. From a CMD (or COMMAND on '95/98) window: @@ -605,7 +621,7 @@ A) Using MSVC If you want to link with ruby, normally you must use the same compiler as which was used to build the ruby binary. RubyInstaller is built with MinGW, so normally you cannot use MSVC for building Vim if you want to link with -RubyInstaller. If you use a different complier, there are mainly two problems: +RubyInstaller. If you use a different compiler, there are mainly two problems: config.h and Ruby's DLL name. Here are the steps for working around them: 1) Download and Install RubyInstaller. @@ -639,9 +655,10 @@ config.h and Ruby's DLL name. Here are the steps for working around them: nmake -f Make_mvc.mak RUBY=C:\Ruby22 DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_VER_LONG=2.2.0 RUBY_MSVCRT_NAME=msvcrt - WINVER=0x500 + WINVER=0x501 - WINVER must be set to >=0x500, when building with Ruby 2.1 or later. + If you set WINVER explicitly, it must be set to >=0x500, when building + with Ruby 2.1 or later. (Default is 0x501.) When using this trick, you also need to set RUBY_MSVCRT_NAME to msvcrt which is used for the Ruby's DLL name. @@ -652,9 +669,11 @@ After you install RubyInstaller, just type this (as one line): mingw32-make -f Make_ming.mak RUBY=C:/Ruby22 DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_VER_LONG=2.2.0 - WINVER=0x500 + WINVER=0x501 + +If you set WINVER explicitly, it must be set to >=0x500, when building with +Ruby 2.1 or later. (Default is 0x501.) -WINVER must be set to >=0x500, when building with Ruby 2.1 or later. 12. Building with Tcl support diff --git a/src/version.c b/src/version.c index 75d4746920..92bf72689a 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1766, /**/ 1765, /**/ From 0c1ff16b5467f97ce08134fdbc8198127bbe492a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 18:01:28 +0200 Subject: [PATCH 07/11] updated runtime files. Add avra syntax. --- runtime/optwin.vim | 2 +- runtime/synmenu.vim | 1 + runtime/syntax/avra.vim | 73 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 runtime/syntax/avra.vim diff --git a/runtime/optwin.vim b/runtime/optwin.vim index b88f3017c1..2ba347eee7 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar -" Last Change: 2016 Mar 19 +" Last Change: 2016 Apr 21 " If there already is an option window, jump to that one. if bufwinnr("option-window") > 0 diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index 76f60131f2..01dad3c7f2 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -61,6 +61,7 @@ an 50.10.320 &Syntax.AB.Ascii\ Doc :cal SetSyn("asciidoc") an 50.10.330 &Syntax.AB.ASP\ with\ VBScript :cal SetSyn("aspvbs") an 50.10.340 &Syntax.AB.ASP\ with\ Perl :cal SetSyn("aspperl") an 50.10.350 &Syntax.AB.Assembly.680x0 :cal SetSyn("asm68k") +an 50.10.355 &Syntax.AB.Assembly.AVR :cal SetSyn("avra") an 50.10.360 &Syntax.AB.Assembly.Flat :cal SetSyn("fasm") an 50.10.370 &Syntax.AB.Assembly.GNU :cal SetSyn("asm") an 50.10.380 &Syntax.AB.Assembly.GNU\ H-8300 :cal SetSyn("asmh8300") diff --git a/runtime/syntax/avra.vim b/runtime/syntax/avra.vim new file mode 100644 index 0000000000..ebf0aaff11 --- /dev/null +++ b/runtime/syntax/avra.vim @@ -0,0 +1,73 @@ +" Vim syntax file +" Language: AVR Assembler (AVRA) +" AVRA Home: http://avra.sourceforge.net/index.html +" AVRA Version: 1.3.0 +" Maintainer: Marius Ghita + +let s:cpo_save = &cpo +set cpo&vim + +setlocal iskeyword=a-z,A-Z,48-57,.,_ +" 'isident' is a global option, better not set it +" setlocal isident=a-z,A-Z,48-57,.,_ +syn case ignore + +syn keyword avraRegister r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 +syn keyword avraRegister r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 +syn keyword avraRegister r28 r29 r30 r31 + +syn keyword avraInstr add adc adiw sub subi sbc sbci sbiw and andi or ori eor +syn keyword avraInstr com neg sbr cbr inc dec tst clr ser mul muls mulsu fmul +syn keyword avraInstr fmuls fmulsu des rjmp ijmp eijmp jmp rcall icall eicall +syn keyword avraInstr call ret reti cpse cp cpc cpi sbrc sbrs sbic sbis brbs +syn keyword avraInstr brbc breq brne brcs brcc brsh brlo brmi brpl brge brlt +syn keyword avraInstr brhs brhc brts brtc brvs brvc brie brid mov movw ldi lds +syn keyword avraInstr ld ldd sts st std lpm elpm spm in out push pop xch las +syn keyword avraInstr lac lat lsl lsr rol ror asr swap bset bclr sbi cbi bst bld +syn keyword avraInstr sec clc sen cln sez clz sei cli ses cls sev clv set clt +syn keyword avraInstr seh clh break nop sleep wdr + +syn keyword avraDirective .byte .cseg .db .def .device .dseg .dw .endmacro .equ +syn keyword avraDirective .eseg .exit .include .list .listmac .macro .nolist +syn keyword avraDirective .org .set .define .undef .ifdef .ifndef .if .else +syn keyword avraDirective .elif .elseif .warning + +syn keyword avraOperator low high byte2 byte3 byte4 lwrd hwrd page exp2 log2 + +syn match avraNumericOperator "[-*/+]" +syn match avraUnaryOperator "!" +syn match avraBinaryOperator "<<\|>>\|<\|<=\|>\|>=\|==\|!=" +syn match avraBitwiseOperator "[~&^|]\|&&\|||" + +syn match avraBinaryNumber "\<0[bB][0-1]*\>" +syn match avraHexNumber "\<0[xX][0-9a-fA-F]\+\>" +syn match avraDecNumber "\<\(0\|[1-9]\d*\)\>" + +syn region avraComment start=";" end="$" +syn region avraString start="\"" end="\"\|$" + +syn match avraLabel "^\s*[^; \t]\+:" + +hi def link avraBinaryNumber avraNumber +hi def link avraHexNumber avraNumber +hi def link avraDecNumber avraNumber + +hi def link avraNumericOperator avraOperator +hi def link avraUnaryOperator avraOperator +hi def link avraBinaryOperator avraOperator +hi def link avraBitwiseOperator avraOperator + + +hi def link avraOperator operator +hi def link avraComment comment +hi def link avraDirective preproc +hi def link avraRegister type +hi def link avraNumber constant +hi def link avraString String +hi def link avraInstr keyword +hi def link avraLabel label + +let b:current_syntax = "avra" + +let &cpo = s:cpo_save +unlet s:cpo_save From 4adfaabfe7e07da9546b45130cad0d266ba48611 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 18:20:11 +0200 Subject: [PATCH 08/11] patch 7.4.1767 Problem: When installing Vim on a GTK system the icon cache is not updated. Solution: Update the GTK icon cache when possible. (Kazunobu Kuriyama) --- src/Makefile | 17 +++++- src/auto/configure | 132 +++++++++++++++++++++++++++++++++++++++++++++ src/config.mk.in | 3 ++ src/configure.in | 32 +++++++++++ src/version.c | 2 + 5 files changed, 185 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 195cbd5c64..69e3a4b9f7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1977,7 +1977,6 @@ test1 \ test_listlbr_utf8 \ test_mapping \ test_marks \ - test_match_conceal \ test_nested_function \ test_options \ test_ruby \ @@ -2013,11 +2012,14 @@ test_arglist \ test_delete \ test_ex_undo \ test_expand \ + test_expand_dllpath \ test_expr \ + test_expr_utf8 \ test_feedkeys \ test_file_perm \ test_fnamemodify \ test_glob2regpat \ + test_goto \ test_hardcopy \ test_help_tagjump \ test_history \ @@ -2026,8 +2028,11 @@ test_arglist \ test_json \ test_langmap \ test_lispwords \ + test_matchadd_conceal \ + test_matchadd_conceal_utf8 \ test_matchstrpos \ test_menu \ + test_messages \ test_packadd \ test_partial \ test_perl \ @@ -2042,6 +2047,7 @@ test_arglist \ test_syn_attr \ test_syntax \ test_tabline \ + test_tagjump \ test_timers \ test_undolevels \ test_unlet \ @@ -2350,12 +2356,18 @@ install-languages: languages $(DEST_LANG) $(DEST_KMAP) ICON48PATH = $(DESTDIR)$(DATADIR)/icons/hicolor/48x48/apps ICON32PATH = $(DESTDIR)$(DATADIR)/icons/locolor/32x32/apps ICON16PATH = $(DESTDIR)$(DATADIR)/icons/locolor/16x16/apps +ICONTHEMEPATH = $(DATADIR)/icons/hicolor DESKTOPPATH = $(DESTDIR)$(DATADIR)/applications KDEPATH = $(HOME)/.kde/share/icons install-icons: if test -d $(ICON48PATH) -a -w $(ICON48PATH) \ -a ! -f $(ICON48PATH)/gvim.png; then \ $(INSTALL_DATA) $(SCRIPTSOURCE)/vim48x48.png $(ICON48PATH)/gvim.png; \ + if test -z "$(DESTDIR)" -a -x $(GTK_UPDATE_ICON_CACHE) \ + -a -w $(ICONTHEMEPATH) \ + -a -f $(ICONTHEMEPATH)/index.theme; then \ + $(GTK_UPDATE_ICON_CACHE) -q $(ICONTHEMEPATH); \ + fi \ fi if test -d $(ICON32PATH) -a -w $(ICON32PATH) \ -a ! -f $(ICON32PATH)/gvim.png; then \ @@ -2369,6 +2381,9 @@ install-icons: $(INSTALL_DATA) $(SCRIPTSOURCE)/vim.desktop \ $(SCRIPTSOURCE)/gvim.desktop \ $(DESKTOPPATH); \ + if test -z "$(DESTDIR)" -a -x $(UPDATE_DESKTOP_DATABASE); then \ + $(UPDATE_DESKTOP_DATABASE) -q $(DESKTOPPATH); \ + fi \ fi $(HELPSOURCE)/vim.1 $(MACROSOURCE) $(TOOLSSOURCE): diff --git a/src/auto/configure b/src/auto/configure index 91b075d95a..ff3a63b4b5 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -638,6 +638,8 @@ NARROW_PROTO MOTIF_LIBNAME GRESOURCE_OBJ GRESOURCE_SRC +UPDATE_DESKTOP_DATABASE +GTK_UPDATE_ICON_CACHE GLIB_COMPILE_RESOURCES GNOME_INCLUDEDIR GNOME_LIBDIR @@ -828,6 +830,8 @@ enable_gtktest with_gnome_includes with_gnome_libs with_gnome +enable_icon_cache_update +enable_desktop_database_update with_motif_lib with_tlib enable_largefile @@ -1488,6 +1492,8 @@ Optional Features: --enable-nextaw-check If auto-select GUI, check for neXtaw default=yes --enable-carbon-check If auto-select GUI, check for Carbon default=yes --disable-gtktest Do not try to compile and run a test GTK program + --disable-icon-cache-update update disabled + --disable-desktop-database-update update disabled --disable-largefile omit support for large files --disable-acl Don't check for ACL support. --disable-gpm Don't use gpm (Linux mouse daemon). @@ -9351,8 +9357,134 @@ $as_echo "not usable." >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot obtain from pkg_config." >&5 $as_echo "cannot obtain from pkg_config." >&6; } fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-icon-cache-update argument" >&5 +$as_echo_n "checking --disable-icon-cache-update argument... " >&6; } + # Check whether --enable-icon_cache_update was given. +if test "${enable_icon_cache_update+set}" = set; then : + enableval=$enable_icon_cache_update; +else + enable_icon_cache_update="yes" fi + if test "$enable_icon_cache_update" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not set" >&5 +$as_echo "not set" >&6; } + # Extract the first word of "gtk-update-icon-cache", so it can be a program name with args. +set dummy gtk-update-icon-cache; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GTK_UPDATE_ICON_CACHE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GTK_UPDATE_ICON_CACHE in + [\\/]* | ?:[\\/]*) + ac_cv_path_GTK_UPDATE_ICON_CACHE="$GTK_UPDATE_ICON_CACHE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GTK_UPDATE_ICON_CACHE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GTK_UPDATE_ICON_CACHE" && ac_cv_path_GTK_UPDATE_ICON_CACHE="no" + ;; +esac +fi +GTK_UPDATE_ICON_CACHE=$ac_cv_path_GTK_UPDATE_ICON_CACHE +if test -n "$GTK_UPDATE_ICON_CACHE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_UPDATE_ICON_CACHE" >&5 +$as_echo "$GTK_UPDATE_ICON_CACHE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found in PATH." >&5 +$as_echo "not found in PATH." >&6; } + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: update disabled" >&5 +$as_echo "update disabled" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-desktop-database-update argument" >&5 +$as_echo_n "checking --disable-desktop-database-update argument... " >&6; } + # Check whether --enable-desktop_database_update was given. +if test "${enable_desktop_database_update+set}" = set; then : + enableval=$enable_desktop_database_update; +else + enable_desktop_database_update="yes" +fi + + if test "$enable_desktop_database_update" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not set" >&5 +$as_echo "not set" >&6; } + # Extract the first word of "update-desktop-database", so it can be a program name with args. +set dummy update-desktop-database; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_UPDATE_DESKTOP_DATABASE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $UPDATE_DESKTOP_DATABASE in + [\\/]* | ?:[\\/]*) + ac_cv_path_UPDATE_DESKTOP_DATABASE="$UPDATE_DESKTOP_DATABASE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_UPDATE_DESKTOP_DATABASE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_UPDATE_DESKTOP_DATABASE" && ac_cv_path_UPDATE_DESKTOP_DATABASE="no" + ;; +esac +fi +UPDATE_DESKTOP_DATABASE=$ac_cv_path_UPDATE_DESKTOP_DATABASE +if test -n "$UPDATE_DESKTOP_DATABASE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UPDATE_DESKTOP_DATABASE" >&5 +$as_echo "$UPDATE_DESKTOP_DATABASE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found in PATH." >&5 +$as_echo "not found in PATH." >&6; } + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: update disabled" >&5 +$as_echo "update disabled" >&6; } + fi +fi + + + diff --git a/src/config.mk.in b/src/config.mk.in index 1002d7c7c3..90a3337789 100644 --- a/src/config.mk.in +++ b/src/config.mk.in @@ -162,6 +162,9 @@ GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ GRESOURCE_SRC = @GRESOURCE_SRC@ GRESOURCE_OBJ = @GRESOURCE_OBJ@ +GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@ +UPDATE_DESKTOP_DATABASE = @UPDATE_DESKTOP_DATABASE@ + ### Any OS dependent extra source and object file OS_EXTRA_SRC = @OS_EXTRA_SRC@ OS_EXTRA_OBJ = @OS_EXTRA_OBJ@ diff --git a/src/configure.in b/src/configure.in index 0a8c95bc6e..279ed47227 100644 --- a/src/configure.in +++ b/src/configure.in @@ -2688,10 +2688,42 @@ if test "x$GUITYPE" = "xGTK"; then else AC_MSG_RESULT([cannot obtain from pkg_config.]) fi + + AC_MSG_CHECKING([--disable-icon-cache-update argument]) + AC_ARG_ENABLE(icon_cache_update, + [ --disable-icon-cache-update update disabled], + [], + [enable_icon_cache_update="yes"]) + if test "$enable_icon_cache_update" = "yes"; then + AC_MSG_RESULT([not set]) + AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,[gtk-update-icon-cache],no) + if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then + AC_MSG_RESULT([not found in PATH.]) + fi + else + AC_MSG_RESULT([update disabled]) + fi + + AC_MSG_CHECKING([--disable-desktop-database-update argument]) + AC_ARG_ENABLE(desktop_database_update, + [ --disable-desktop-database-update update disabled], + [], + [enable_desktop_database_update="yes"]) + if test "$enable_desktop_database_update" = "yes"; then + AC_MSG_RESULT([not set]) + AC_PATH_PROG(UPDATE_DESKTOP_DATABASE,[update-desktop-database],no) + if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then + AC_MSG_RESULT([not found in PATH.]) + fi + else + AC_MSG_RESULT([update disabled]) + fi fi AC_SUBST(GLIB_COMPILE_RESOURCES) AC_SUBST(GRESOURCE_SRC) AC_SUBST(GRESOURCE_OBJ) +AC_SUBST(GTK_UPDATE_ICON_CACHE) +AC_SUBST(UPDATE_DESKTOP_DATABASE) dnl Check for Motif include files location. dnl The LAST one found is used, this makes the highest version to be used, diff --git a/src/version.c b/src/version.c index 92bf72689a..1b15dedb04 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1767, /**/ 1766, /**/ From d106e5ba7f10f0d2a14eaefe5d78405044416cb9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 19:38:07 +0200 Subject: [PATCH 09/11] patch 7.4.1768 Problem: Arguments of setqflist() are not checked properly. Solution: Add better checks, add a test. (Nikolai Pavlov, Hirohito Higashi, closes #661) --- src/eval.c | 14 ++++- src/testdir/test_quickfix.vim | 102 +++++++++++++++++++++++++++++++--- src/version.c | 2 + 3 files changed, 107 insertions(+), 11 deletions(-) diff --git a/src/eval.c b/src/eval.c index 1daf042e18..b82a98fdb1 100644 --- a/src/eval.c +++ b/src/eval.c @@ -98,6 +98,7 @@ static char *e_listarg = N_("E686: Argument of %s must be a List"); static char *e_listdictarg = N_("E712: Argument of %s must be a List or Dictionary"); static char *e_listreq = N_("E714: List required"); static char *e_dictreq = N_("E715: Dictionary required"); +static char *e_stringreq = N_("E928: String required"); static char *e_toomanyarg = N_("E118: Too many arguments for function: %s"); static char *e_dictkey = N_("E716: Key not present in Dictionary: %s"); static char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it"); @@ -18280,8 +18281,9 @@ set_qf_ll_list( typval_T *rettv) { #ifdef FEAT_QUICKFIX + static char *e_invact = N_("E927: Invalid action: '%s'"); char_u *act; - int action = ' '; + int action = 0; #endif rettv->vval.v_number = -1; @@ -18298,11 +18300,17 @@ set_qf_ll_list( act = get_tv_string_chk(action_arg); if (act == NULL) return; /* type error; errmsg already given */ - if (*act == 'a' || *act == 'r') + if ((*act == 'a' || *act == 'r' || *act == ' ') && act[1] == NUL) action = *act; + else + EMSG2(_(e_invact), act); } + else if (action_arg->v_type == VAR_UNKNOWN) + action = ' '; + else + EMSG(_(e_stringreq)); - if (l != NULL && set_errorlist(wp, l, action, + if (l != NULL && action && set_errorlist(wp, l, action, (char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK) rettv->vval.v_number = 0; } diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 17b07630f9..e0da0d0007 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -501,7 +501,7 @@ endfunction function Test_locationlist_curwin_was_closed() augroup testgroup au! - autocmd BufReadCmd t call R(expand("")) + autocmd BufReadCmd test_curwin.txt call R(expand("")) augroup END function! R(n) @@ -510,7 +510,7 @@ function Test_locationlist_curwin_was_closed() new let q = [] - call add(q, {'filename': 't' }) + call add(q, {'filename': 'test_curwin.txt' }) call setloclist(0, q) call assert_fails('lrewind', 'E924:') @@ -643,14 +643,14 @@ function XquickfixChangedByAutocmd(cchar) let Xgetexpr = a:cchar . 'getexpr' let Xrewind = a:cchar . 'rewind' if a:cchar == 'c' - let Xsetlist = 'setqflist(' + let Xsetlist = function('setqflist') let ErrorNr = 'E925' function! ReadFunc() colder cgetexpr [] endfunc else - let Xsetlist = 'setloclist(0,' + let Xsetlist = function('setloclist', [0]) let ErrorNr = 'E926' function! ReadFunc() lolder @@ -660,15 +660,15 @@ function XquickfixChangedByAutocmd(cchar) augroup testgroup au! - autocmd BufReadCmd t call ReadFunc() + autocmd BufReadCmd test_changed.txt call ReadFunc() augroup END - bwipe! + new | only let words = [ "a", "b" ] let qflist = [] for word in words - call add(qflist, {'filename': 't'}) - exec "call " . Xsetlist . "qflist, '')" + call add(qflist, {'filename': 'test_changed.txt'}) + call Xsetlist(qflist, ' ') endfor exec "call assert_fails('" . Xrewind . "', '" . ErrorNr . ":')" @@ -745,3 +745,89 @@ function Test_setqflist() call delete('Xtestfile') endfunction + +function! XquickfixSetListWithAct(cchar) + let Xolder = a:cchar . 'older' + let Xnewer = a:cchar . 'newer' + if a:cchar == 'c' + let Xsetlist = function('setqflist') + let Xgetlist = function('getqflist') + else + let Xsetlist = function('setloclist', [0]) + let Xgetlist = function('getloclist', [0]) + endif + let list1 = [{'filename': 'fnameA', 'text': 'A'}, + \ {'filename': 'fnameB', 'text': 'B'}] + let list2 = [{'filename': 'fnameC', 'text': 'C'}, + \ {'filename': 'fnameD', 'text': 'D'}, + \ {'filename': 'fnameE', 'text': 'E'}] + + " {action} is unspecified. Same as specifing ' '. + new | only + exec "silent! " . Xnewer . "99" + call Xsetlist(list1) + call Xsetlist(list2) + let li = Xgetlist() + call assert_equal(3, len(li)) + call assert_equal('C', li[0]['text']) + call assert_equal('D', li[1]['text']) + call assert_equal('E', li[2]['text']) + exec "silent! " . Xolder + let li = Xgetlist() + call assert_equal(2, len(li)) + call assert_equal('A', li[0]['text']) + call assert_equal('B', li[1]['text']) + + " {action} is specified ' '. + new | only + exec "silent! " . Xnewer . "99" + call Xsetlist(list1) + call Xsetlist(list2, ' ') + let li = Xgetlist() + call assert_equal(3, len(li)) + call assert_equal('C', li[0]['text']) + call assert_equal('D', li[1]['text']) + call assert_equal('E', li[2]['text']) + exec "silent! " . Xolder + let li = Xgetlist() + call assert_equal(2, len(li)) + call assert_equal('A', li[0]['text']) + call assert_equal('B', li[1]['text']) + + " {action} is specified 'a'. + new | only + exec "silent! " . Xnewer . "99" + call Xsetlist(list1) + call Xsetlist(list2, 'a') + let li = Xgetlist() + call assert_equal(5, len(li)) + call assert_equal('A', li[0]['text']) + call assert_equal('B', li[1]['text']) + call assert_equal('C', li[2]['text']) + call assert_equal('D', li[3]['text']) + call assert_equal('E', li[4]['text']) + + " {action} is specified 'r'. + new | only + exec "silent! " . Xnewer . "99" + call Xsetlist(list1) + call Xsetlist(list2, 'r') + let li = Xgetlist() + call assert_equal(3, len(li)) + call assert_equal('C', li[0]['text']) + call assert_equal('D', li[1]['text']) + call assert_equal('E', li[2]['text']) + + " Test for wrong value. + new | only + call assert_fails("call Xsetlist(0)", 'E714:') + call assert_fails("call Xsetlist(list1, '')", 'E927:') + call assert_fails("call Xsetlist(list1, 'aa')", 'E927:') + call assert_fails("call Xsetlist(list1, ' a')", 'E927:') + call assert_fails("call Xsetlist(list1, 0)", 'E928:') +endfunc + +function Test_quickfix_set_list_with_act() + call XquickfixSetListWithAct('c') + call XquickfixSetListWithAct('l') +endfunction diff --git a/src/version.c b/src/version.c index 1b15dedb04..9c0387253c 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1768, /**/ 1767, /**/ From 6d4431e7b675ba7a0194c0b8eb84b7d92e4e7953 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 20:00:56 +0200 Subject: [PATCH 10/11] patch 7.4.1769 Problem: No "closed", "errors" and "encoding" attribute on Python output. Solution: Add attributes and more tests. (Roland Puntaier, closes #622) --- src/if_py_both.h | 1 + src/if_python.c | 5 ++++- src/if_python3.c | 4 ++++ src/testdir/test86.in | 5 +++++ src/testdir/test86.ok | 7 ++++++- src/testdir/test87.in | 5 +++++ src/testdir/test87.ok | 7 ++++++- src/version.c | 2 ++ 8 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index de3e8680b5..a0385f9a5c 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -503,6 +503,7 @@ static struct PyMethodDef OutputMethods[] = { {"readable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, {"seekable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, {"writable", (PyCFunction)AlwaysTrue, METH_NOARGS, ""}, + {"closed", (PyCFunction)AlwaysFalse, METH_NOARGS, ""}, {"__dir__", (PyCFunction)OutputDir, METH_NOARGS, ""}, { NULL, NULL, 0, NULL} }; diff --git a/src/if_python.c b/src/if_python.c index a54a0e217d..622634da75 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -1195,7 +1195,10 @@ OutputGetattr(PyObject *self, char *name) return PyInt_FromLong(((OutputObject *)(self))->softspace); else if (strcmp(name, "__members__") == 0) return ObjectDir(NULL, OutputAttrs); - + else if (strcmp(name, "errors") == 0) + return PyString_FromString("strict"); + else if (strcmp(name, "encoding") == 0) + return PyString_FromString(ENC_OPT); return Py_FindMethod(OutputMethods, self, name); } diff --git a/src/if_python3.c b/src/if_python3.c index d2f6066cb8..10984cdfe8 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -1100,6 +1100,10 @@ OutputGetattro(PyObject *self, PyObject *nameobj) if (strcmp(name, "softspace") == 0) return PyLong_FromLong(((OutputObject *)(self))->softspace); + else if (strcmp(name, "errors") == 0) + return PyString_FromString("strict"); + else if (strcmp(name, "encoding") == 0) + return PyString_FromString(ENC_OPT); return PyObject_GenericGetAttr(self, nameobj); } diff --git a/src/testdir/test86.in b/src/testdir/test86.in index 6f47ff6813..71fe920ad2 100644 --- a/src/testdir/test86.in +++ b/src/testdir/test86.in @@ -1289,6 +1289,11 @@ ee('assert sys.stdout.writable()==True') ee('assert sys.stdout.readable()==False') ee('assert sys.stderr.writable()==True') ee('assert sys.stderr.readable()==False') +ee('assert sys.stdout.closed()==False') +ee('assert sys.stderr.closed()==False') +ee('assert sys.stdout.errors=="strict"') +ee('assert sys.stderr.errors=="strict"') +ee('assert sys.stdout.encoding==sys.stderr.encoding') ee('sys.stdout.write(None)') cb.append(">> OutputWriteLines") ee('sys.stdout.writelines(None)') diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index fe27c05a7b..85290402ce 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -449,7 +449,7 @@ range:__dir__,__members__,append,end,start dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values list:__dir__,__members__,extend,locked function:__dir__,__members__,args,self,softspace -output:__dir__,__members__,close,flush,isatty,readable,seekable,softspace,writable,write,writelines +output:__dir__,__members__,close,closed,flush,isatty,readable,seekable,softspace,writable,write,writelines {} {'a': 1} {'a': 1} @@ -600,6 +600,11 @@ assert sys.stdout.writable()==True:NOT FAILED assert sys.stdout.readable()==False:NOT FAILED assert sys.stderr.writable()==True:NOT FAILED assert sys.stderr.readable()==False:NOT FAILED +assert sys.stdout.closed()==False:NOT FAILED +assert sys.stderr.closed()==False:NOT FAILED +assert sys.stdout.errors=="strict":NOT FAILED +assert sys.stderr.errors=="strict":NOT FAILED +assert sys.stdout.encoding==sys.stderr.encoding:NOT FAILED sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',) >> OutputWriteLines sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",) diff --git a/src/testdir/test87.in b/src/testdir/test87.in index e3bc994ba1..0df002feba 100644 --- a/src/testdir/test87.in +++ b/src/testdir/test87.in @@ -1283,6 +1283,11 @@ ee('assert sys.stdout.writable()==True') ee('assert sys.stdout.readable()==False') ee('assert sys.stderr.writable()==True') ee('assert sys.stderr.readable()==False') +ee('assert sys.stdout.closed()==False') +ee('assert sys.stderr.closed()==False') +ee('assert sys.stdout.errors=="strict"') +ee('assert sys.stderr.errors=="strict"') +ee('assert sys.stdout.encoding==sys.stderr.encoding') ee('sys.stdout.write(None)') cb.append(">> OutputWriteLines") ee('sys.stdout.writelines(None)') diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index 25c0b51032..10069b9959 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -449,7 +449,7 @@ range:__dir__,append,end,start dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values list:__dir__,extend,locked function:__dir__,args,self,softspace -output:__dir__,close,flush,isatty,readable,seekable,softspace,writable,write,writelines +output:__dir__,close,closed,flush,isatty,readable,seekable,softspace,writable,write,writelines {} {'a': 1} {'a': 1} @@ -600,6 +600,11 @@ assert sys.stdout.writable()==True:NOT FAILED assert sys.stdout.readable()==False:NOT FAILED assert sys.stderr.writable()==True:NOT FAILED assert sys.stderr.readable()==False:NOT FAILED +assert sys.stdout.closed()==False:NOT FAILED +assert sys.stderr.closed()==False:NOT FAILED +assert sys.stdout.errors=="strict":NOT FAILED +assert sys.stderr.errors=="strict":NOT FAILED +assert sys.stdout.encoding==sys.stderr.encoding:NOT FAILED sys.stdout.write(None):(, TypeError("Can't convert 'NoneType' object to str implicitly",)) >> OutputWriteLines sys.stdout.writelines(None):(, TypeError("'NoneType' object is not iterable",)) diff --git a/src/version.c b/src/version.c index 9c0387253c..4599f8827c 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1769, /**/ 1768, /**/ From 8a633e3427b47286869aa4b96f2bfc1fe65b25cd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 21 Apr 2016 21:10:14 +0200 Subject: [PATCH 11/11] patch 7.4.1770 Problem: Cannot use true color in the terminal. Solution: Add the 'guicolors' option. (Nikolai Pavlov) --- runtime/doc/options.txt | 14 +- runtime/doc/term.txt | 22 ++- runtime/doc/various.txt | 1 + src/auto/configure | 18 +++ src/config.h.in | 3 + src/configure.in | 9 ++ src/eval.c | 3 + src/globals.h | 4 + src/hardcopy.c | 6 +- src/option.c | 24 +++- src/option.h | 3 + src/proto/term.pro | 5 + src/screen.c | 100 ++++++++++---- src/structs.h | 8 +- src/syntax.c | 296 ++++++++++++++++++++++++++++------------ src/term.c | 208 +++++++++++++++++++++++++++- src/term.h | 8 +- src/version.c | 7 + src/vim.h | 25 ++++ 19 files changed, 644 insertions(+), 120 deletions(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 80d2360937..8310a68bae 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2016 Apr 20 +*options.txt* For Vim version 7.4. Last change: 2016 Apr 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3477,6 +3477,18 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. + *'guicolors'* *'gcol'* +'guicolors' 'gcol' boolean (default off) + global + {not in Vi} + {not available when compiled without the + |+termtruecolor| feature} + When on, uses |highlight-guifg| and |highlight-guibg| attributes in + the terminal (thus using 24-bit color). Requires a ISO-8613-3 + compatible terminal. + If setting this option does not work (produces a colorless UI) + reading |xterm-true-color| might help. + *'guicursor'* *'gcr'* *E545* *E546* *E548* *E549* 'guicursor' 'gcr' string (default "n-v-c:block-Cursor/lCursor, ve:ver35-Cursor, diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 4359764fdc..0ac5b41b35 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 7.4. Last change: 2015 Nov 24 +*term.txt* For Vim version 7.4. Last change: 2016 Apr 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -303,6 +303,10 @@ Added by Vim (there are no standard codes for these): see |'ambiwidth'| t_RB request terminal background color *t_RB* *'t_RB'* see |'ambiwidth'| + t_8f set foreground color (R, G, B) *t_8f* *'t_8f'* + |xterm-true-color| + t_8b set background color (R, G, B) *t_8b* *'t_8b'* + |xterm-true-color| KEY CODES Note: Use the <> form if possible @@ -419,6 +423,22 @@ VT220, etc.). The result is that codes like are no longer needed. Note: This is only done on startup. If the xterm options are changed after Vim has started, the escape sequences may not be recognized anymore. + *xterm-true-color* +Vim supports using true colors in the terminal (taken from |highlight-guifg| +and |highlight-guibg|), given that terminal supports this. To make this +work, 'guicolors' option needs to be set. + +Sometimes setting 'guicolors' is not enough and one has to set the |t_8f| and +|t_8b| options explicitly. Default values of these options are +`^[[38;2;%lu;%lu;%lum` and `^[[48;2;%lu;%lu;%lum` (replace `^[` with real +escape) respectively, but it is only set when `$TERM` is `xterm`. Some +terminals accept the same sequences, but with all semicolons replaced by +colons (this is actually more compatible, but less widely supported). These +options contain printf strings, with |printf()| (actually, its C equivalent +hence `l` modifier) invoked with the t_ option value and three unsigned long +integers that may have any value between 0 and 255 (inclusive) representing +red, green and blue colors respectively. + *xterm-resize* Window resizing with xterm only works if the allowWindowOps resource is enabled. On some systems and versions of xterm it's disabled by default diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 8e5100507e..b73949f98b 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -424,6 +424,7 @@ m *+tcl* Tcl interface |tcl| m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn| *+terminfo* uses |terminfo| instead of termcap N *+termresponse* support for |t_RV| and |v:termresponse| +m *+termtruecolor* 24-bit color in xterm-compatible terminals support N *+textobjects* |text-objects| selection *+tgetent* non-Unix only: able to use external termcap N *+timers* the |timer_start()| function diff --git a/src/auto/configure b/src/auto/configure index ff3a63b4b5..ba0d0b05ab 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -810,6 +810,7 @@ with_tclsh enable_rubyinterp with_ruby_command enable_cscope +enable_termtruecolor enable_workshop enable_netbeans enable_channel @@ -1476,6 +1477,7 @@ Optional Features: --enable-tclinterp=OPTS Include Tcl interpreter. default=no OPTS=no/yes/dynamic --enable-rubyinterp=OPTS Include Ruby interpreter. default=no OPTS=no/yes/dynamic --enable-cscope Include cscope interface. + --enable-termtruecolor Include support for 24-bit colors in ISO-8613-3 compatible terminals --enable-workshop Include Sun Visual Workshop support. --disable-netbeans Disable NetBeans integration support. --disable-channel Disable process communication support. @@ -7216,6 +7218,22 @@ if test "$enable_cscope" = "yes"; then fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-termtruecolor argument" >&5 +$as_echo_n "checking --enable-termtruecolor argument... " >&6; } +# Check whether --enable-termtruecolor was given. +if test "${enable_termtruecolor+set}" = set; then : + enableval=$enable_termtruecolor; +else + enable_termtruecolor="no" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_termtruecolor" >&5 +$as_echo "$enable_termtruecolor" >&6; } +if test "$enable_termtruecolor" = "yes"; then + $as_echo "#define FEAT_TERMTRUECOLOR 1" >>confdefs.h + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-workshop argument" >&5 $as_echo_n "checking --enable-workshop argument... " >&6; } # Check whether --enable-workshop was given. diff --git a/src/config.h.in b/src/config.h.in index 9d35e48fa6..6c0f7798de 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -362,6 +362,9 @@ /* Define for linking via dlopen() or LoadLibrary() */ #undef DYNAMIC_TCL +/* Define if you want 24-bit colors in ISO-8613-3 compatible terminals. */ +#undef FEAT_TERMTRUECOLOR + /* Define if you want to add support for ACL */ #undef HAVE_POSIX_ACL #undef HAVE_SOLARIS_ZFS_ACL diff --git a/src/configure.in b/src/configure.in index 279ed47227..d1d7838802 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1926,6 +1926,15 @@ if test "$enable_cscope" = "yes"; then AC_DEFINE(FEAT_CSCOPE) fi +AC_MSG_CHECKING(--enable-termtruecolor argument) +AC_ARG_ENABLE(termtruecolor, + [ --enable-termtruecolor Include support for 24-bit colors in ISO-8613-3 compatible terminals], , + [enable_termtruecolor="no"]) +AC_MSG_RESULT($enable_termtruecolor) +if test "$enable_termtruecolor" = "yes"; then + AC_DEFINE(FEAT_TERMTRUECOLOR) +fi + AC_MSG_CHECKING(--enable-workshop argument) AC_ARG_ENABLE(workshop, [ --enable-workshop Include Sun Visual Workshop support.], , diff --git a/src/eval.c b/src/eval.c index b82a98fdb1..3542b777f4 100644 --- a/src/eval.c +++ b/src/eval.c @@ -14044,6 +14044,9 @@ f_has(typval_T *argvars, typval_T *rettv) #ifdef FEAT_TERMRESPONSE "termresponse", #endif +#ifdef FEAT_TERMTRUECOLOR + "termtruecolor", +#endif #ifdef FEAT_TEXTOBJ "textobjects", #endif diff --git a/src/globals.h b/src/globals.h index 5effdb5630..8cc9bedf9b 100644 --- a/src/globals.h +++ b/src/globals.h @@ -369,6 +369,10 @@ EXTERN char_u *use_gvimrc INIT(= NULL); /* "-U" cmdline argument */ EXTERN int cterm_normal_fg_color INIT(= 0); EXTERN int cterm_normal_fg_bold INIT(= 0); EXTERN int cterm_normal_bg_color INIT(= 0); +#ifdef FEAT_TERMTRUECOLOR +EXTERN long_u cterm_normal_fg_gui_color INIT(= INVALCOLOR); +EXTERN long_u cterm_normal_bg_gui_color INIT(= INVALCOLOR); +#endif #ifdef FEAT_AUTOCMD EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */ diff --git a/src/hardcopy.c b/src/hardcopy.c index f65a6dd40a..aaa20102c8 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -164,7 +164,7 @@ parse_printoptions(void) #if (defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)) || defined(PROTO) /* - * Parse 'printoptions' and set the flags in "printer_opts". + * Parse 'printmbfont' and set the flags in "mbfont_opts". * Returns an error message or NULL; */ char_u * @@ -307,8 +307,8 @@ prt_get_attr( pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL); pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL); -# ifdef FEAT_GUI - if (gui.in_use) +# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) + if (USE_24BIT) { bg_color = highlight_gui_color_rgb(hl_id, FALSE); if (bg_color == PRCOLOR_BLACK) diff --git a/src/option.c b/src/option.c index a5b403cf9f..da02864123 100644 --- a/src/option.c +++ b/src/option.c @@ -1305,7 +1305,16 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCRIPTID_INIT}, - {"guicursor", "gcr", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, + {"guicolors", "gcol", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, +#ifdef FEAT_TERMTRUECOLOR + (char_u *)&p_guicolors, PV_NONE, + {(char_u *)FALSE, (char_u *)FALSE} +#else + (char_u*)NULL, PV_NONE, + {(char_u *)FALSE, (char_u *)FALSE} +#endif + SCRIPTID_INIT}, + {"guicursor", "gcr", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, #ifdef CURSOR_SHAPE (char_u *)&p_guicursor, PV_NONE, { @@ -3011,6 +3020,8 @@ static struct vimoption options[] = p_term("t_xs", T_XS) p_term("t_ZH", T_CZH) p_term("t_ZR", T_CZR) + p_term("t_8f", T_8F) + p_term("t_8b", T_8B) /* terminal key codes are not in here */ @@ -8353,6 +8364,17 @@ set_bool_option( #endif +#ifdef FEAT_TERMTRUECOLOR + /* 'guicolors' */ + else if ((int *)varp == &p_guicolors) + { +# ifdef FEAT_GUI + if (!gui.in_use && !gui.starting) +# endif + highlight_gui_started(); + } +#endif + /* * End of handling side effects for bool options. */ diff --git a/src/option.h b/src/option.h index cf7ba04e7e..60889ab432 100644 --- a/src/option.h +++ b/src/option.h @@ -527,6 +527,9 @@ EXTERN char_u *p_popt; /* 'printoptions' */ EXTERN char_u *p_header; /* 'printheader' */ #endif EXTERN int p_prompt; /* 'prompt' */ +#ifdef FEAT_TERMTRUECOLOR +EXTERN int p_guicolors; /* 'guicolors' */ +#endif #ifdef FEAT_GUI EXTERN char_u *p_guifont; /* 'guifont' */ # ifdef FEAT_XFONTSET diff --git a/src/proto/term.pro b/src/proto/term.pro index 58369794c6..cd2ca26d38 100644 --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -1,4 +1,7 @@ /* term.c */ +guicolor_T termtrue_mch_get_color(char_u *name); +guicolor_T termtrue_get_color(char_u *name); +long_u termtrue_mch_get_rgb(guicolor_T color); int set_termname(char_u *term); void set_mouse_termcode(int n, char_u *s); void del_mouse_termcode(int n); @@ -22,6 +25,8 @@ void term_set_winpos(int x, int y); void term_set_winsize(int width, int height); void term_fg_color(int n); void term_bg_color(int n); +void term_fg_rgb_color(long_u rgb); +void term_bg_rgb_color(long_u rgb); void term_settitle(char_u *title); void ttest(int pairs); void add_long_to_buf(long_u val, char_u *dst); diff --git a/src/screen.c b/src/screen.c index b92cbf9e26..5dc8ffe280 100644 --- a/src/screen.c +++ b/src/screen.c @@ -7828,7 +7828,7 @@ screen_start_highlight(int attr) { if (attr > HL_ALL) /* special HL attr. */ { - if (t_colors > 1) + if (IS_CTERM) aep = syn_cterm_attr2entry(attr); else aep = syn_term_attr2entry(attr); @@ -7839,8 +7839,16 @@ screen_start_highlight(int attr) } if ((attr & HL_BOLD) && T_MD != NULL) /* bold */ out_str(T_MD); - else if (aep != NULL && t_colors > 1 && aep->ae_u.cterm.fg_color - && cterm_normal_fg_bold) + else if (aep != NULL && cterm_normal_fg_bold && +#ifdef FEAT_TERMTRUECOLOR + (p_guicolors ? + (aep->ae_u.cterm.fg_rgb != INVALCOLOR): +#endif + (t_colors > 1 && aep->ae_u.cterm.fg_color) +#ifdef FEAT_TERMTRUECOLOR + ) +#endif + ) /* If the Normal FG color has BOLD attribute and the new HL * has a FG color defined, clear BOLD. */ out_str(T_ME); @@ -7860,17 +7868,29 @@ screen_start_highlight(int attr) */ if (aep != NULL) { - if (t_colors > 1) +#ifdef FEAT_TERMTRUECOLOR + if (p_guicolors) { - if (aep->ae_u.cterm.fg_color) - term_fg_color(aep->ae_u.cterm.fg_color - 1); - if (aep->ae_u.cterm.bg_color) - term_bg_color(aep->ae_u.cterm.bg_color - 1); + if (aep->ae_u.cterm.fg_rgb != INVALCOLOR) + term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); + if (aep->ae_u.cterm.bg_rgb != INVALCOLOR) + term_bg_rgb_color(aep->ae_u.cterm.bg_rgb); } else +#endif { - if (aep->ae_u.term.start != NULL) - out_str(aep->ae_u.term.start); + if (t_colors > 1) + { + if (aep->ae_u.cterm.fg_color) + term_fg_color(aep->ae_u.cterm.fg_color - 1); + if (aep->ae_u.cterm.bg_color) + term_bg_color(aep->ae_u.cterm.bg_color - 1); + } + else + { + if (aep->ae_u.term.start != NULL) + out_str(aep->ae_u.term.start); + } } } } @@ -7904,14 +7924,23 @@ screen_stop_highlight(void) { attrentry_T *aep; - if (t_colors > 1) + if (IS_CTERM) { /* * Assume that t_me restores the original colors! */ aep = syn_cterm_attr2entry(screen_attr); - if (aep != NULL && (aep->ae_u.cterm.fg_color - || aep->ae_u.cterm.bg_color)) + if (aep != NULL && +#ifdef FEAT_TERMTRUECOLOR + (p_guicolors ? + (aep->ae_u.cterm.fg_rgb != INVALCOLOR || + aep->ae_u.cterm.bg_rgb != INVALCOLOR): +#endif + (aep->ae_u.cterm.fg_color || aep->ae_u.cterm.bg_color) +#ifdef FEAT_TERMTRUECOLOR + ) +#endif + ) do_ME = TRUE; } else @@ -7959,15 +7988,27 @@ screen_stop_highlight(void) if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE))) out_str(T_ME); - if (t_colors > 1) +#ifdef FEAT_TERMTRUECOLOR + if (p_guicolors) { - /* set Normal cterm colors */ - if (cterm_normal_fg_color != 0) - term_fg_color(cterm_normal_fg_color - 1); - if (cterm_normal_bg_color != 0) - term_bg_color(cterm_normal_bg_color - 1); - if (cterm_normal_fg_bold) - out_str(T_MD); + if (cterm_normal_fg_gui_color != INVALCOLOR) + term_fg_rgb_color(cterm_normal_fg_gui_color); + if (cterm_normal_bg_gui_color != INVALCOLOR) + term_bg_rgb_color(cterm_normal_bg_gui_color); + } + else +#endif + { + if (t_colors > 1) + { + /* set Normal cterm colors */ + if (cterm_normal_fg_color != 0) + term_fg_color(cterm_normal_fg_color - 1); + if (cterm_normal_bg_color != 0) + term_bg_color(cterm_normal_bg_color - 1); + if (cterm_normal_fg_bold) + out_str(T_MD); + } } } } @@ -7981,10 +8022,17 @@ screen_stop_highlight(void) void reset_cterm_colors(void) { - if (t_colors > 1) + if (IS_CTERM) { /* set Normal cterm colors */ +#ifdef FEAT_TERMTRUECOLOR + if (p_guicolors ? + (cterm_normal_fg_gui_color != INVALCOLOR + || cterm_normal_bg_gui_color != INVALCOLOR): + (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)) +#else if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0) +#endif { out_str(T_OP); screen_attr = -1; @@ -8228,7 +8276,7 @@ screen_fill( #ifdef FEAT_GUI !gui.in_use && #endif - t_colors <= 1); + !IS_CTERM); for (row = start_row; row < end_row; ++row) { #ifdef FEAT_MBYTE @@ -8910,6 +8958,9 @@ can_clear(char_u *p) return (*p != NUL && (t_colors <= 1 #ifdef FEAT_GUI || gui.in_use +#endif +#ifdef FEAT_TERMTRUECOLOR + || (p_guicolors && cterm_normal_bg_gui_color != INVALCOLOR) #endif || cterm_normal_bg_color == 0 || *T_UT != NUL)); } @@ -10241,6 +10292,9 @@ draw_tabline(void) int use_sep_chars = (t_colors < 8 #ifdef FEAT_GUI && !gui.in_use +#endif +#ifdef FEAT_TERMTRUECOLOR + && !p_guicolors #endif ); diff --git a/src/structs.h b/src/structs.h index adee3e807e..1775256996 100644 --- a/src/structs.h +++ b/src/structs.h @@ -84,7 +84,9 @@ typedef struct file_buffer buf_T; /* forward declaration */ # ifdef FEAT_XCLIPBOARD # include # endif -# define guicolor_T int /* avoid error in prototypes */ +# define guicolor_T long_u /* avoid error in prototypes and + * make FEAT_TERMTRUECOLOR work */ +# define INVALCOLOR ((guicolor_T)0x1ffffff) #endif /* @@ -911,6 +913,10 @@ typedef struct attr_entry /* These colors need to be > 8 bits to hold 256. */ short_u fg_color; /* foreground color number */ short_u bg_color; /* background color number */ +# ifdef FEAT_TERMTRUECOLOR + long_u fg_rgb; /* foreground color RGB */ + long_u bg_rgb; /* background color RGB */ +# endif } cterm; # ifdef FEAT_GUI struct diff --git a/src/syntax.c b/src/syntax.c index 31c1d0d533..76a5976551 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -33,10 +33,12 @@ struct hl_group int sg_cterm_fg; /* terminal fg color number + 1 */ int sg_cterm_bg; /* terminal bg color number + 1 */ int sg_cterm_attr; /* Screen attr for color term mode */ -#ifdef FEAT_GUI /* for when using the GUI */ +#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) guicolor_T sg_gui_fg; /* GUI foreground color handle */ guicolor_T sg_gui_bg; /* GUI background color handle */ +#endif +#ifdef FEAT_GUI guicolor_T sg_gui_sp; /* GUI special color handle */ GuiFont sg_font; /* GUI font handle */ #ifdef FEAT_XFONTSET @@ -97,10 +99,12 @@ static int syn_list_header(int did_header, int outlen, int id); static int hl_has_settings(int idx, int check_link); static void highlight_clear(int idx); -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) static void gui_do_one_color(int idx, int do_menu, int do_tooltip); -static int set_group_colors(char_u *name, guicolor_T *fgp, guicolor_T *bgp, int do_menu, int use_norm, int do_tooltip); static guicolor_T color_name2handle(char_u *name); +#endif +#ifdef FEAT_GUI +static int set_group_colors(char_u *name, guicolor_T *fgp, guicolor_T *bgp, int do_menu, int use_norm, int do_tooltip); static GuiFont font_name2handle(char_u *name); # ifdef FEAT_XFONTSET static GuiFontset fontset_name2handle(char_u *name, int fixed_width); @@ -7333,8 +7337,8 @@ do_highlight( for (idx = 0; idx < highlight_ga.ga_len; ++idx) highlight_clear(idx); init_highlight(TRUE, TRUE); -#ifdef FEAT_GUI - if (gui.in_use) +#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) + if (USE_24BIT) highlight_gui_started(); #endif highlight_changed(); @@ -7788,10 +7792,16 @@ do_highlight( if (!init) HL_TABLE()[idx].sg_set |= SG_GUI; -# ifdef FEAT_GUI +# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) /* In GUI guifg colors are only used when recognized */ i = color_name2handle(arg); - if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use) + if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 +# ifdef FEAT_GUI + || !(USE_24BIT) +# else + || !p_guicolors +# endif + ) { HL_TABLE()[idx].sg_gui_fg = i; # endif @@ -7800,7 +7810,7 @@ do_highlight( HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg); else HL_TABLE()[idx].sg_gui_fg_name = NULL; -# ifdef FEAT_GUI +# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) # ifdef FEAT_GUI_X11 if (is_menu_group) gui.menu_fg_pixel = i; @@ -7825,10 +7835,10 @@ do_highlight( if (!init) HL_TABLE()[idx].sg_set |= SG_GUI; -# ifdef FEAT_GUI +# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) /* In GUI guifg colors are only used when recognized */ i = color_name2handle(arg); - if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use) + if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) { HL_TABLE()[idx].sg_gui_bg = i; # endif @@ -7837,7 +7847,7 @@ do_highlight( HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg); else HL_TABLE()[idx].sg_gui_bg_name = NULL; -# ifdef FEAT_GUI +# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) # ifdef FEAT_GUI_X11 if (is_menu_group) gui.menu_bg_pixel = i; @@ -7997,7 +8007,9 @@ do_highlight( * Need to update all groups, because they might be using "bg" * and/or "fg", which have been changed now. */ - if (gui.in_use) +#endif +#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) + if (USE_24BIT) highlight_gui_started(); #endif } @@ -8068,6 +8080,10 @@ restore_cterm_colors(void) cterm_normal_fg_color = 0; cterm_normal_fg_bold = 0; cterm_normal_bg_color = 0; +# ifdef FEAT_TERMTRUECOLOR + cterm_normal_fg_gui_color = INVALCOLOR; + cterm_normal_bg_gui_color = INVALCOLOR; +# endif #endif } @@ -8118,9 +8134,11 @@ highlight_clear(int idx) vim_free(HL_TABLE()[idx].sg_gui_sp_name); HL_TABLE()[idx].sg_gui_sp_name = NULL; #endif -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) HL_TABLE()[idx].sg_gui_fg = INVALCOLOR; HL_TABLE()[idx].sg_gui_bg = INVALCOLOR; +#endif +#ifdef FEAT_GUI HL_TABLE()[idx].sg_gui_sp = INVALCOLOR; gui_mch_free_font(HL_TABLE()[idx].sg_font); HL_TABLE()[idx].sg_font = NOFONT; @@ -8140,7 +8158,7 @@ highlight_clear(int idx) #endif } -#if defined(FEAT_GUI) || defined(PROTO) +#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO) /* * Set the normal foreground and background colors according to the "Normal" * highlighting group. For X11 also set "Menu", "Scrollbar", and @@ -8149,44 +8167,78 @@ highlight_clear(int idx) void set_normal_colors(void) { - if (set_group_colors((char_u *)"Normal", - &gui.norm_pixel, &gui.back_pixel, - FALSE, TRUE, FALSE)) - { - gui_mch_new_colors(); - must_redraw = CLEAR; - } -#ifdef FEAT_GUI_X11 - if (set_group_colors((char_u *)"Menu", - &gui.menu_fg_pixel, &gui.menu_bg_pixel, - TRUE, FALSE, FALSE)) - { -# ifdef FEAT_MENU - gui_mch_new_menu_colors(); +#ifdef FEAT_GUI +# ifdef FEAT_TERMTRUECOLOR + if (gui.in_use) # endif - must_redraw = CLEAR; - } -# ifdef FEAT_BEVAL - if (set_group_colors((char_u *)"Tooltip", - &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, - FALSE, FALSE, TRUE)) { -# ifdef FEAT_TOOLBAR - gui_mch_new_tooltip_colors(); + if (set_group_colors((char_u *)"Normal", + &gui.norm_pixel, &gui.back_pixel, + FALSE, TRUE, FALSE)) + { + gui_mch_new_colors(); + must_redraw = CLEAR; + } +# ifdef FEAT_GUI_X11 + if (set_group_colors((char_u *)"Menu", + &gui.menu_fg_pixel, &gui.menu_bg_pixel, + TRUE, FALSE, FALSE)) + { +# ifdef FEAT_MENU + gui_mch_new_menu_colors(); +# endif + must_redraw = CLEAR; + } +# ifdef FEAT_BEVAL + if (set_group_colors((char_u *)"Tooltip", + &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, + FALSE, FALSE, TRUE)) + { +# ifdef FEAT_TOOLBAR + gui_mch_new_tooltip_colors(); +# endif + must_redraw = CLEAR; + } +# endif + if (set_group_colors((char_u *)"Scrollbar", + &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, + FALSE, FALSE, FALSE)) + { + gui_new_scrollbar_colors(); + must_redraw = CLEAR; + } # endif - must_redraw = CLEAR; } #endif - if (set_group_colors((char_u *)"Scrollbar", - &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, - FALSE, FALSE, FALSE)) +#ifdef FEAT_TERMTRUECOLOR +# ifdef FEAT_GUI + else +# endif { - gui_new_scrollbar_colors(); - must_redraw = CLEAR; + int idx; + + idx = syn_name2id((char_u *)"Normal") - 1; + if (idx >= 0) + { + gui_do_one_color(idx, FALSE, FALSE); + + if (HL_TABLE()[idx].sg_gui_fg != INVALCOLOR) + { + cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg; + must_redraw = CLEAR; + } + if (HL_TABLE()[idx].sg_gui_bg != INVALCOLOR) + { + cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; + must_redraw = CLEAR; + } + } } #endif } +#endif +#if defined(FEAT_GUI) || defined(PROTO) /* * Set the colors for "Normal", "Menu", "Tooltip" or "Scrollbar". */ @@ -8298,24 +8350,6 @@ hl_set_fg_color_name( } } -/* - * Return the handle for a color name. - * Returns INVALCOLOR when failed. - */ - static guicolor_T -color_name2handle(char_u *name) -{ - if (STRCMP(name, "NONE") == 0) - return INVALCOLOR; - - if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0) - return gui.norm_pixel; - if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0) - return gui.back_pixel; - - return gui_get_color(name); -} - /* * Return the handle for a font name. * Returns NOFONT when failed. @@ -8439,6 +8473,52 @@ hl_do_font( #endif /* FEAT_GUI */ +#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO) +/* + * Return the handle for a color name. + * Returns INVALCOLOR when failed. + */ + static guicolor_T +color_name2handle(char_u *name) +{ + if (STRCMP(name, "NONE") == 0) + return INVALCOLOR; + + if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0) + { +#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) + if (gui.in_use) +#endif +#ifdef FEAT_GUI + return gui.norm_pixel; +#endif +#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) + else +#endif +#ifdef FEAT_TERMTRUECOLOR + return cterm_normal_fg_gui_color; +#endif + } + if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0) + { +#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) + if (gui.in_use) +#endif +#ifdef FEAT_GUI + return gui.back_pixel; +#endif +#if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) + else +#endif +#ifdef FEAT_TERMTRUECOLOR + return cterm_normal_bg_gui_color; +#endif + } + + return GUI_GET_COLOR(name); +} +#endif + /* * Table with the specifications for an attribute number. * Note that this table is used by ALL buffers. This is required because the @@ -8514,8 +8594,15 @@ get_attr_entry(garray_T *table, attrentry_T *aep) && aep->ae_u.cterm.fg_color == taep->ae_u.cterm.fg_color && aep->ae_u.cterm.bg_color - == taep->ae_u.cterm.bg_color) - )) + == taep->ae_u.cterm.bg_color +#ifdef FEAT_TERMTRUECOLOR + && aep->ae_u.cterm.fg_rgb + == taep->ae_u.cterm.fg_rgb + && aep->ae_u.cterm.bg_rgb + == taep->ae_u.cterm.bg_rgb +#endif + + ))) return i + ATTR_OFF; } @@ -8580,6 +8667,10 @@ get_attr_entry(garray_T *table, attrentry_T *aep) { taep->ae_u.cterm.fg_color = aep->ae_u.cterm.fg_color; taep->ae_u.cterm.bg_color = aep->ae_u.cterm.bg_color; +#ifdef FEAT_TERMTRUECOLOR + taep->ae_u.cterm.fg_rgb = aep->ae_u.cterm.fg_rgb; + taep->ae_u.cterm.bg_rgb = aep->ae_u.cterm.bg_rgb; +#endif } ++table->ga_len; return (table->ga_len - 1 + ATTR_OFF); @@ -8671,7 +8762,7 @@ hl_combine_attr(int char_attr, int prim_attr) } #endif - if (t_colors > 1) + if (IS_CTERM) { if (char_attr > HL_ALL) char_aep = syn_cterm_attr2entry(char_attr); @@ -8696,6 +8787,12 @@ hl_combine_attr(int char_attr, int prim_attr) new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; if (spell_aep->ae_u.cterm.bg_color > 0) new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; +#ifdef FEAT_TERMTRUECOLOR + if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR) + new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; + if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR) + new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; +#endif } } return get_attr_entry(&cterm_attr_table, &new_en); @@ -8757,10 +8854,10 @@ syn_attr2attr(int attr) aep = syn_gui_attr2entry(attr); else #endif - if (t_colors > 1) - aep = syn_cterm_attr2entry(attr); - else - aep = syn_term_attr2entry(attr); + if (IS_CTERM) + aep = syn_cterm_attr2entry(attr); + else + aep = syn_term_attr2entry(attr); if (aep == NULL) /* highlighting not set */ return 0; @@ -8959,13 +9056,15 @@ highlight_color( return NULL; if (modec == 'g') { -# ifdef FEAT_GUI +# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +# ifdef FEAT_GUI /* return font name */ if (font) return HL_TABLE()[id - 1].sg_font_name; +# endif /* return #RRGGBB form (only possible when GUI is running) */ - if (gui.in_use && what[2] == '#') + if ((USE_24BIT) && what[2] == '#') { guicolor_T color; long_u rgb; @@ -8974,19 +9073,23 @@ highlight_color( if (fg) color = HL_TABLE()[id - 1].sg_gui_fg; else if (sp) +# ifdef FEAT_GUI color = HL_TABLE()[id - 1].sg_gui_sp; +# else + color = INVALCOLOR; +# endif else color = HL_TABLE()[id - 1].sg_gui_bg; if (color == INVALCOLOR) return NULL; - rgb = gui_mch_get_rgb(color); + rgb = GUI_MCH_GET_RGB(color); sprintf((char *)buf, "#%02x%02x%02x", (unsigned)(rgb >> 16), (unsigned)(rgb >> 8) & 255, (unsigned)rgb & 255); return buf; } -#endif +# endif if (fg) return (HL_TABLE()[id - 1].sg_gui_fg_name); if (sp) @@ -9011,8 +9114,9 @@ highlight_color( } #endif -#if (defined(FEAT_SYN_HL) && defined(FEAT_GUI) && defined(FEAT_PRINTER)) \ - || defined(PROTO) +#if (defined(FEAT_SYN_HL) \ + && (defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)) \ + && defined(FEAT_PRINTER)) || defined(PROTO) /* * Return color name of highlight group "id" as RGB value. */ @@ -9034,7 +9138,7 @@ highlight_gui_color_rgb( if (color == INVALCOLOR) return 0L; - return gui_mch_get_rgb(color); + return GUI_MCH_GET_RGB(color); } #endif @@ -9150,13 +9254,22 @@ set_hl_attr( * For the color term mode: If there are other than "normal" * highlighting attributes, need to allocate an attr number. */ - if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0) + if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0 +# ifdef FEAT_TERMTRUECOLOR + && sgp->sg_gui_fg == INVALCOLOR + && sgp->sg_gui_bg == INVALCOLOR +# endif + ) sgp->sg_cterm_attr = sgp->sg_cterm; else { at_en.ae_attr = sgp->sg_cterm; at_en.ae_u.cterm.fg_color = sgp->sg_cterm_fg; at_en.ae_u.cterm.bg_color = sgp->sg_cterm_bg; +# ifdef FEAT_TERMTRUECOLOR + at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB(sgp->sg_gui_fg); + at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB(sgp->sg_gui_bg); +# endif sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en); } } @@ -9307,10 +9420,12 @@ syn_add_group(char_u *name) vim_memset(&(HL_TABLE()[highlight_ga.ga_len]), 0, sizeof(struct hl_group)); HL_TABLE()[highlight_ga.ga_len].sg_name = name; HL_TABLE()[highlight_ga.ga_len].sg_name_u = vim_strsave_up(name); -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR; HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR; +# ifdef FEAT_GUI HL_TABLE()[highlight_ga.ga_len].sg_gui_sp = INVALCOLOR; +# endif #endif ++highlight_ga.ga_len; @@ -9349,7 +9464,7 @@ syn_id2attr(int hl_id) attr = sgp->sg_gui_attr; else #endif - if (t_colors > 1) + if (IS_CTERM) attr = sgp->sg_cterm_attr; else attr = sgp->sg_term_attr; @@ -9403,7 +9518,7 @@ syn_get_final_id(int hl_id) return hl_id; } -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) /* * Call this function just after the GUI has started. * It finds the font and color handles for the highlighting groups. @@ -9414,7 +9529,12 @@ highlight_gui_started(void) int idx; /* First get the colors from the "Normal" and "Menu" group, if set */ - set_normal_colors(); +# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) +# ifdef FEAT_TERMTRUECOLOR + if (USE_24BIT) +# endif + set_normal_colors(); +# endif for (idx = 0; idx < highlight_ga.ga_len; ++idx) gui_do_one_color(idx, FALSE, FALSE); @@ -9430,12 +9550,17 @@ gui_do_one_color( { int didit = FALSE; - if (HL_TABLE()[idx].sg_font_name != NULL) - { - hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu, +# ifdef FEAT_GUI +# ifdef FEAT_TERMTRUECOLOR + if (gui.in_use) +# endif + if (HL_TABLE()[idx].sg_font_name != NULL) + { + hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu, do_tooltip, TRUE); - didit = TRUE; - } + didit = TRUE; + } +# endif if (HL_TABLE()[idx].sg_gui_fg_name != NULL) { HL_TABLE()[idx].sg_gui_fg = @@ -9448,16 +9573,17 @@ gui_do_one_color( color_name2handle(HL_TABLE()[idx].sg_gui_bg_name); didit = TRUE; } +# ifdef FEAT_GUI if (HL_TABLE()[idx].sg_gui_sp_name != NULL) { HL_TABLE()[idx].sg_gui_sp = color_name2handle(HL_TABLE()[idx].sg_gui_sp_name); didit = TRUE; } +# endif if (didit) /* need to get a new attr number */ set_hl_attr(idx); } - #endif /* diff --git a/src/term.c b/src/term.c index f6f8eae619..82f8012b07 100644 --- a/src/term.c +++ b/src/term.c @@ -77,6 +77,9 @@ struct builtin_term static struct builtin_term *find_builtin_term(char_u *name); static void parse_builtin_tcap(char_u *s); static void term_color(char_u *s, int n); +#ifdef FEAT_TERMTRUECOLOR +static void term_rgb_color(char_u *s, long_u rgb); +#endif static void gather_termleader(void); #ifdef FEAT_TERMRESPONSE static void req_codes_from_term(void); @@ -382,9 +385,9 @@ static struct builtin_term builtin_termcaps[] = # else {(int)KS_CRI, "\033[%dC"}, # endif -#if defined(BEOS_DR8) +# if defined(BEOS_DR8) {(int)KS_DB, ""}, /* hack! see screen.c */ -#endif +# endif {K_UP, "\033[A"}, {K_DOWN, "\033[B"}, @@ -790,8 +793,10 @@ static struct builtin_term builtin_termcaps[] = # endif # endif -# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__) +# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__) || defined(FEAT_TERMTRUECOLOR) {(int)KS_NAME, "xterm"}, +# endif +# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__) {(int)KS_CE, IF_EB("\033[K", ESC_STR "[K")}, {(int)KS_AL, IF_EB("\033[L", ESC_STR "[L")}, # ifdef TERMINFO @@ -939,6 +944,10 @@ static struct builtin_term builtin_termcaps[] = {TERMCAP2KEY('F', 'Q'), IF_EB("\033[57;*~", ESC_STR "[57;*~")}, /* F36 */ {TERMCAP2KEY('F', 'R'), IF_EB("\033[58;*~", ESC_STR "[58;*~")}, /* F37 */ # endif +# ifdef FEAT_TERMTRUECOLOR + {(int)KS_8F, IF_EB("\033[38;2;%lu;%lu;%lum", ESC_STR "[38;2;%lu;%lu;%lum")}, + {(int)KS_8B, IF_EB("\033[48;2;%lu;%lu;%lum", ESC_STR "[48;2;%lu;%lu;%lum")}, +# endif # if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) /* @@ -1257,6 +1266,171 @@ static struct builtin_term builtin_termcaps[] = }; /* end of builtin_termcaps */ +#if defined(FEAT_TERMTRUECOLOR) || defined(PROTO) +# define RGB(r, g, b) ((r<<16) | (g<<8) | (b)) +struct rgbcolor_table_S { + char_u *color_name; + guicolor_T color; +}; +static struct rgbcolor_table_S rgb_table[] = { + {(char_u *)"black", RGB(0x00, 0x00, 0x00)}, + {(char_u *)"blue", RGB(0x00, 0x00, 0xD4)}, + {(char_u *)"brown", RGB(0x80, 0x40, 0x40)}, + {(char_u *)"cyan", RGB(0x02, 0xAB, 0xEA)}, + {(char_u *)"darkblue", RGB(0x00, 0x00, 0x80)}, + {(char_u *)"darkcyan", RGB(0x00, 0x80, 0x80)}, + {(char_u *)"darkgray", RGB(0x80, 0x80, 0x80)}, + {(char_u *)"darkgreen", RGB(0x00, 0x80, 0x00)}, + {(char_u *)"darkgrey", RGB(0x80, 0x80, 0x80)}, + {(char_u *)"darkmagenta", RGB(0x80, 0x00, 0x80)}, + {(char_u *)"darkred", RGB(0x80, 0x00, 0x00)}, + {(char_u *)"darkyellow", RGB(0xBB, 0xBB, 0x00)}, + {(char_u *)"gray", RGB(0xC0, 0xC0, 0xC0)}, + {(char_u *)"gray10", RGB(0x1A, 0x1A, 0x1A)}, + {(char_u *)"gray20", RGB(0x33, 0x33, 0x33)}, + {(char_u *)"gray30", RGB(0x4D, 0x4D, 0x4D)}, + {(char_u *)"gray40", RGB(0x66, 0x66, 0x66)}, + {(char_u *)"gray50", RGB(0x7F, 0x7F, 0x7F)}, + {(char_u *)"gray60", RGB(0x99, 0x99, 0x99)}, + {(char_u *)"gray70", RGB(0xB3, 0xB3, 0xB3)}, + {(char_u *)"gray80", RGB(0xCC, 0xCC, 0xCC)}, + {(char_u *)"gray90", RGB(0xE5, 0xE5, 0xE5)}, + {(char_u *)"green", RGB(0x00, 0x64, 0x11)}, + {(char_u *)"grey", RGB(0xC0, 0xC0, 0xC0)}, + {(char_u *)"grey10", RGB(0x1A, 0x1A, 0x1A)}, + {(char_u *)"grey20", RGB(0x33, 0x33, 0x33)}, + {(char_u *)"grey30", RGB(0x4D, 0x4D, 0x4D)}, + {(char_u *)"grey40", RGB(0x66, 0x66, 0x66)}, + {(char_u *)"grey50", RGB(0x7F, 0x7F, 0x7F)}, + {(char_u *)"grey60", RGB(0x99, 0x99, 0x99)}, + {(char_u *)"grey70", RGB(0xB3, 0xB3, 0xB3)}, + {(char_u *)"grey80", RGB(0xCC, 0xCC, 0xCC)}, + {(char_u *)"grey90", RGB(0xE5, 0xE5, 0xE5)}, + {(char_u *)"lightblue", RGB(0xA0, 0xA0, 0xFF)}, + {(char_u *)"lightcyan", RGB(0xA0, 0xFF, 0xFF)}, + {(char_u *)"lightgray", RGB(0xE0, 0xE0, 0xE0)}, + {(char_u *)"lightgreen", RGB(0xA0, 0xFF, 0xA0)}, + {(char_u *)"lightgrey", RGB(0xE0, 0xE0, 0xE0)}, + {(char_u *)"lightmagenta",RGB(0xF0, 0xA0, 0xF0)}, + {(char_u *)"lightred", RGB(0xFF, 0xA0, 0xA0)}, + {(char_u *)"lightyellow", RGB(0xFF, 0xFF, 0xA0)}, + {(char_u *)"magenta", RGB(0xF2, 0x08, 0x84)}, + {(char_u *)"orange", RGB(0xFC, 0x80, 0x00)}, + {(char_u *)"purple", RGB(0xA0, 0x20, 0xF0)}, + {(char_u *)"red", RGB(0xDD, 0x08, 0x06)}, + {(char_u *)"seagreen", RGB(0x2E, 0x8B, 0x57)}, + {(char_u *)"slateblue", RGB(0x6A, 0x5A, 0xCD)}, + {(char_u *)"violet", RGB(0x8D, 0x38, 0xC9)}, + {(char_u *)"white", RGB(0xFF, 0xFF, 0xFF)}, + {(char_u *)"yellow", RGB(0xFC, 0xF3, 0x05)}, +}; + + static int +hex_digit(int c) +{ + if (isdigit(c)) + return c - '0'; + c = TOLOWER_ASC(c); + if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + return 0x1ffffff; +} + + guicolor_T +termtrue_mch_get_color(char_u *name) +{ + guicolor_T color; + int i; + + if (*name == '#' && strlen((char *) name) == 7) + { + color = RGB(((hex_digit(name[1])<<4) + hex_digit(name[2])), + ((hex_digit(name[3])<<4) + hex_digit(name[4])), + ((hex_digit(name[5])<<4) + hex_digit(name[6]))); + if (color > 0xffffff) + return INVALCOLOR; + return color; + } + else + { + /* Check if the name is one of the colors we know */ + for (i = 0; i < sizeof(rgb_table) / sizeof(rgb_table[0]); i++) + if (STRICMP(name, rgb_table[i].color_name) == 0) + return rgb_table[i].color; + } + + /* + * Last attempt. Look in the file "$VIM/rgb.txt". + */ + { +#define LINE_LEN 100 + FILE *fd; + char line[LINE_LEN]; + char_u *fname; + int r, g, b; + + fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt"); + if (fname == NULL) + return INVALCOLOR; + + fd = fopen((char *)fname, "rt"); + vim_free(fname); + if (fd == NULL) + return INVALCOLOR; + + while (!feof(fd)) + { + int len; + int pos; + char *color; + + fgets(line, LINE_LEN, fd); + len = strlen(line); + + if (len <= 1 || line[len-1] != '\n') + continue; + + line[len-1] = '\0'; + + i = sscanf(line, "%d %d %d %n", &r, &g, &b, &pos); + if (i != 3) + continue; + + color = line + pos; + + if (STRICMP(color, name) == 0) + { + fclose(fd); + return (guicolor_T) RGB(r, g, b); + } + } + fclose(fd); + } + + return INVALCOLOR; +} + + guicolor_T +termtrue_get_color(char_u *name) +{ + guicolor_T t; + + if (*name == NUL) + return INVALCOLOR; + t = termtrue_mch_get_color(name); + + if (t == INVALCOLOR) + EMSG2(_("E254: Cannot allocate color %s"), name); + return t; +} + + long_u +termtrue_mch_get_rgb(guicolor_T color) +{ + return (long_u) color; +} +#endif + /* * DEFAULT_TERM is used, when no terminal is specified with -T option or $TERM. */ @@ -1512,6 +1686,7 @@ set_termname(char_u *term) {KS_CWP, "WP"}, {KS_CWS, "WS"}, {KS_CSI, "SI"}, {KS_CEI, "EI"}, {KS_U7, "u7"}, {KS_RBG, "RB"}, + {KS_8F, "8f"}, {KS_8B, "8b"}, {(enum SpecialKey)0, NULL} }; @@ -2608,6 +2783,33 @@ term_color(char_u *s, int n) OUT_STR(tgoto((char *)s, 0, n)); } +#if defined(FEAT_TERMTRUECOLOR) || defined(PROTO) + void +term_fg_rgb_color(long_u rgb) +{ + term_rgb_color(T_8F, rgb); +} + + void +term_bg_rgb_color(long_u rgb) +{ + term_rgb_color(T_8B, rgb); +} + +#define RED(rgb) ((rgb>>16)&0xFF) +#define GREEN(rgb) ((rgb>> 8)&0xFF) +#define BLUE(rgb) ((rgb )&0xFF) + + static void +term_rgb_color(char_u *s, long_u rgb) +{ + char buf[7+3*3+2+1+1]; + + sprintf(buf, (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb)); + OUT_STR(buf); +} +#endif + #if (defined(FEAT_TITLE) && (defined(UNIX) || defined(VMS) \ || defined(MACOS_X))) || defined(PROTO) /* diff --git a/src/term.h b/src/term.h index 4e284869bb..4a7391c019 100644 --- a/src/term.h +++ b/src/term.h @@ -87,10 +87,12 @@ enum SpecialKey KS_CSV, /* scroll region vertical */ #endif KS_OP, /* original color pair */ - KS_U7 /* request cursor position */ + KS_U7, /* request cursor position */ + KS_8F, /* set foreground color (RGB) */ + KS_8B /* set background color (RGB) */ }; -#define KS_LAST KS_U7 +#define KS_LAST KS_8B /* * the terminal capabilities are stored in this array @@ -166,6 +168,8 @@ extern char_u *(term_strings[]); /* current terminal strings */ #define T_RBG (term_str(KS_RBG)) /* request background RGB */ #define T_OP (term_str(KS_OP)) /* original color pair */ #define T_U7 (term_str(KS_U7)) /* request cursor position */ +#define T_8F (term_str(KS_8F)) /* set foreground color (RGB) */ +#define T_8B (term_str(KS_8B)) /* set background color (RGB) */ #define TMODE_COOK 0 /* terminal mode for external cmds and Ex mode */ #define TMODE_SLEEP 1 /* terminal mode for sleeping (cooked but no echo) */ diff --git a/src/version.c b/src/version.c index 4599f8827c..bb32541ddb 100644 --- a/src/version.c +++ b/src/version.c @@ -621,6 +621,11 @@ static char *(features[]) = #else "-termresponse", #endif +#ifdef FEAT_TERMTRUECOLOR + "+termtruecolor", +#else + "-termtruecolor", +#endif #ifdef FEAT_TEXTOBJ "+textobjects", #else @@ -748,6 +753,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1770, /**/ 1769, /**/ diff --git a/src/vim.h b/src/vim.h index 9e2ab2161a..f503ebf3e4 100644 --- a/src/vim.h +++ b/src/vim.h @@ -1558,6 +1558,31 @@ typedef UINT32_TYPEDEF UINT32_T; #define MSG_PUTS_LONG(s) msg_puts_long_attr((char_u *)(s), 0) #define MSG_PUTS_LONG_ATTR(s, a) msg_puts_long_attr((char_u *)(s), (a)) +#ifdef FEAT_GUI +# ifdef FEAT_TERMTRUECOLOR +# define GUI_FUNCTION(f) (gui.in_use ? gui_##f : termtrue_##f) +# define USE_24BIT (gui.in_use || p_guicolors) +# else +# define GUI_FUNCTION(f) gui_##f +# define USE_24BIT gui.in_use +# endif +#else +# ifdef FEAT_TERMTRUECOLOR +# define GUI_FUNCTION(f) termtrue_##f +# define USE_24BIT p_guicolors +# endif +#endif +#ifdef FEAT_TERMTRUECOLOR +# define IS_CTERM (t_colors > 1 || p_guicolors) +#else +# define IS_CTERM (t_colors > 1) +#endif +#ifdef GUI_FUNCTION +# define GUI_MCH_GET_RGB GUI_FUNCTION(mch_get_rgb) +# define GUI_MCH_GET_COLOR GUI_FUNCTION(mch_get_color) +# define GUI_GET_COLOR GUI_FUNCTION(get_color) +#endif + /* Prefer using emsg3(), because perror() may send the output to the wrong * destination and mess up the screen. */ #ifdef HAVE_STRERROR