diff options
-rw-r--r-- | runtime/doc/eval.txt | 2 | ||||
-rw-r--r-- | runtime/doc/options.txt | 13 | ||||
-rw-r--r-- | runtime/doc/quickref.txt | 1 | ||||
-rw-r--r-- | runtime/doc/term.txt | 29 | ||||
-rw-r--r-- | runtime/doc/various.txt | 2 | ||||
-rw-r--r-- | runtime/syntax/vim.vim | 8 | ||||
-rw-r--r-- | src/nvim/eval.c | 6 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 3 | ||||
-rw-r--r-- | src/nvim/fileio.c | 4 | ||||
-rw-r--r-- | src/nvim/memline.c | 12 | ||||
-rw-r--r-- | src/nvim/os/pty_process.c | 89 | ||||
-rw-r--r-- | src/nvim/syntax.c | 2 | ||||
-rw-r--r-- | src/nvim/version.c | 129 | ||||
-rw-r--r-- | src/nvim/vim.h | 7 |
14 files changed, 115 insertions, 192 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 3c789e1155..1d18a61dbd 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -6654,7 +6654,6 @@ There are four types of features: included. acl Compiled with |ACL| support. -all_builtin_terms Compiled with all builtin terminals enabled. arabic Compiled with Arabic support |Arabic|. autocmd Compiled with autocommand support. |autocommand| balloon_eval Compiled with |balloon-eval| support. @@ -6662,7 +6661,6 @@ balloon_multiline GUI supports multiline balloons. browse Compiled with |:browse| support, and browse() will work. browsefilter Compiled with support for |browsefilter|. -builtin_terms Compiled with some builtin terminals. byte_offset Compiled with support for 'o' in 'statusline' cindent Compiled with 'cindent' support. clientserver Compiled with remote invocation support |clientserver|. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 2967036155..545a9dc828 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -7153,18 +7153,7 @@ A jump table for the options with a short description can be found at |Q_op|. by user preferences or the current theme is used. *'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'* -'ttybuiltin' 'tbi' boolean (default on) - global - {not in Vi} - When on, the builtin termcaps are searched before the external ones. - When off the builtin termcaps are searched after the external ones. - When this option is changed, you should set the 'term' option next for - the change to take effect, for example: > - :set notbi term=$TERM -< See also |termcap|. - Rationale: The default for this option is "on", because the builtin - termcap entries are generally better (many systems contain faulty - xterm entries...). +'ttybuiltin' 'tbi' Removed. {Nvim} *'ttyfast'* *'tf'* *'nottyfast'* *'notf'* 'ttyfast' 'tf' Removed. {Nvim} diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index 5d251e7b68..68a8e878a2 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -909,7 +909,6 @@ Short explanation of each option: *option-list* 'toolbariconsize' 'tbis' size of the toolbar icons (for GTK 2 only) 'ttimeout' time out on mappings 'ttimeoutlen' 'ttm' time out time for key codes in milliseconds -'ttybuiltin' 'tbi' use built-in termcap before external termcap 'ttymouse' 'ttym' type of mouse codes generated 'ttyscroll' 'tsl' maximum number of lines for a scroll 'ttytype' 'tty' alias for 'term' diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 49eb429319..f37ba9b256 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -38,35 +38,6 @@ the choice whether to use terminfo or termcap is done automatically. When running Vim the output of ":version" will show |+terminfo| if terminfo is used. Also see |xterm-screens|. -On non-Unix systems a termcap is only available if Vim was compiled with -TERMCAP defined. - - *builtin-terms* *builtin_terms* -Which builtin terminals are available depends on a few defines in feature.h, -which need to be set at compile time: - define output of ":version" terminals builtin ~ -NO_BUILTIN_TCAPS -builtin_terms none -SOME_BUILTIN_TCAPS +builtin_terms most common ones (default) -ALL_BUILTIN_TCAPS ++builtin_terms all available - -You can see a list of available builtin terminals with ":set term=xxx" (when -not running the GUI). Also see |+builtin_terms|. - -If the termcap code is included Vim will try to get the strings for the -terminal you are using from the termcap file and the builtin termcaps. Both -are always used, if an entry for the terminal you are using is present. Which -one is used first depends on the 'ttybuiltin' option: - -'ttybuiltin' on 1: builtin termcap 2: external termcap -'ttybuiltin' off 1: external termcap 2: builtin termcap - -If an option is missing in one of them, it will be obtained from the other -one. If an option is present in both, the one first encountered is used. - -Which external termcap file is used varies from system to system and may -depend on the environment variables "TERMCAP" and "TERMPATH". See "man -tgetent". - Settings depending on terminal *term-dependent-settings* If you want to set options or mappings, depending on the terminal name, you diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index ced0c24434..c8dc331361 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -306,8 +306,6 @@ m *+balloon_eval* |balloon-eval| support. Included when compiling with supported GUI (Motif, GTK, GUI) and either Netbeans/Sun Workshop integration or |+eval| feature. N *+browse* |:browse| command -N *+builtin_terms* some terminals builtin |builtin-terms| -B *++builtin_terms* maximal terminals builtin |builtin-terms| N *+byte_offset* support for 'o' flag in 'statusline' option, "go" and ":goto" commands. N *+cindent* |'cindent'|, C indenting diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index c5aacec565..8ad6b2819f 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -27,21 +27,21 @@ syn match vimCommand contained "\<z[-+^.=]\=" syn keyword vimStdPlugin contained DiffOrig Man N[ext] P[rint] S TOhtml XMLent XMLns " vimOptions are caught only when contained in a vimSet {{{2 -syn keyword vimOption contained acd ambiwidth arabicshape autowriteall backupdir bdlay binary breakat bufhidden cd ci cinw co commentstring confirm cpoptions cscoperelative csre cursorcolumn delcombine diffopt ea efm ep et fdc fdo ffs filetype fo foldlevelstart formatexpr ft gfw gtt guipty hh hkmap ic imaf iminsert includeexpr inf isident langmap lines lmap ma matchtime mco ml modeline mousefocus mousetime nrformats ofu para pdev pi previewwindow printmbfont qe relativenumber rightleftcmd ru sbr scrolloff selection shellcmdflag shellxescape showbreak si smartcase softtabstop spelllang sps sta su swb synmaxcol tagbsearch tbi termencoding thesaurus titlestring tpm ttm ttytype undodir ut vfile vop wcm whichwrap wildignore winaltkeys winminwidth wmnu write +syn keyword vimOption contained acd ambiwidth arabicshape autowriteall backupdir bdlay binary breakat bufhidden cd ci cinw co commentstring confirm cpoptions cscoperelative csre cursorcolumn delcombine diffopt ea efm ep et fdc fdo ffs filetype fo foldlevelstart formatexpr ft gfw gtt guipty hh hkmap ic imaf iminsert includeexpr inf isident langmap lines lmap ma matchtime mco ml modeline mousefocus mousetime nrformats ofu para pdev pi previewwindow printmbfont qe relativenumber rightleftcmd ru sbr scrolloff selection shellcmdflag shellxescape showbreak si smartcase softtabstop spelllang sps sta su swb synmaxcol tagbsearch termencoding thesaurus titlestring tpm ttm ttytype undodir ut vfile vop wcm whichwrap wildignore winaltkeys winminwidth wmnu write syn keyword vimOption contained ai ambw ari aw backupext beval brk buflisted cdpath cin cinwords cocu compatible cpt cscopetag cst cursorline dex digraph ead ei equalalways eventignore fde fdt fic fillchars foldclose foldmarker formatlistpat gcr ghr guicursor guitablabel hi hkmapp icon imak ims incsearch infercase isk keymap langmenu linespace loadplugins macatsui maxcombine mef mls modelines mousehide mp nu omnifunc paragraphs penc pm printdevice printoptions quoteescape remap rl ruf sc scrollopt selectmode shellpipe shellxquote showcmd sidescroll smartindent sol spellsuggest sr stal sua swf syntax taglength tbidi terse tildeop tl tr tty tw undofile vb vi wa wd wi wildignorecase window winwidth wmw writeany -syn keyword vimOption contained akm anti arshape awa backupskip bex browsedir buftype cedit cindent clipboard cole complete crb cscopetagorder csto cwh dg dip eadirection ek equalprg ex fdi fen fileencoding fk foldcolumn foldmethod formatoptions gd go guifont guitabtooltip hid hkp iconstring imc imsearch inde insertmode iskeyword keymodel laststatus lisp lpl magic maxfuncdepth menuitems mm modifiable mousem mps number opendevice paste pex pmbcs printencoding prompt rdt report rlc ruler scb scs sessionoptions shellquote shiftround showfulltag sidescrolloff smarttab sp spf srr startofline suffixes switchbuf ta tagrelative tbis textauto timeout tm ts ttybuiltin tx undolevels vbs viewdir wak weirdinvert wic wildmenu winfixheight wiv wop writebackup +syn keyword vimOption contained akm anti arshape awa backupskip bex browsedir buftype cedit cindent clipboard cole complete crb cscopetagorder csto cwh dg dip eadirection ek equalprg ex fdi fen fileencoding fk foldcolumn foldmethod formatoptions gd go guifont guitabtooltip hid hkp iconstring imc imsearch inde insertmode iskeyword keymodel laststatus lisp lpl magic maxfuncdepth menuitems mm modifiable mousem mps number opendevice paste pex pmbcs printencoding prompt rdt report rlc ruler scb scs sessionoptions shellquote shiftround showfulltag sidescrolloff smarttab sp spf srr startofline suffixes switchbuf ta tagrelative tbis textauto timeout tm ts tx undolevels vbs viewdir wak weirdinvert wic wildmenu winfixheight wiv wop writebackup syn keyword vimOption contained al antialias autochdir background balloondelay bexpr bk bs casemap cf cink cmdheight colorcolumn completefunc copyindent cscopeverbose csverb debug dict dir eb enc errorbells expandtab fdl fenc fileencodings fkmap foldenable foldminlines formatprg gdefault gp guifontset helpfile hidden hl ignorecase imcmdline imsf indentexpr is isp keywordprg lazyredraw lispwords ls makeef maxmapdepth mfd mmd modified mousemodel msm numberwidth operatorfunc pastetoggle pexpr pmbfn printexpr pt re restorescreen rnu rulerformat scr sect sft shellredir shiftwidth showmatch siso smc spc spl ss statusline suffixesadd sws tabline tags tbs textmode timeoutlen to tsl uc undoreload vdir viewoptions warn wfh wig wildmode winfixwidth wiw wrap writedelay syn keyword vimOption contained aleph ar autoindent backspace ballooneval bg bkc bsdir cb cfu cinkeys cmdwinheight columns completeopt cot cscopepathcomp cspc cuc deco dictionary directory ed encoding errorfile exrc fdls fencs fileformat flp foldexpr foldnestmax fp gfm grepformat guifontwide helpheight highlight hlg im imd imstatusfunc indentkeys isf isprint km lbr list lsp makeprg maxmem mh mmp more mouses mzq nuw opfunc patchexpr pfn popt printfont pumheight readonly revins ro runtimepath scroll sections sh shellslash shm showmode sj smd spell splitbelow ssl stl sw sxe tabpagemax tagstack tenc textwidth title toolbar tsr ttym udf updatecount ve viminfo wb wfw wildchar wildoptions winheight wm wrapmargin ws syn keyword vimOption contained allowrevins arab autoread backup balloonexpr bh bl bsk cc ch cino cmp com concealcursor cp cscopeprg csprg cul def diff display endofline errorformat fcl fdm fex fileformats fml foldignore foldopen fs gfn grepprg guiheadroom helplang history hls imactivatefunc imdisable inc indk isfname joinspaces kmp lcs listchars lw mat maxmempattern mis mmt mouse mouseshape mzquantum odev patchmode ph preserveindent printheader pvh redrawtime ri rs sb scrollbind secure shcf shelltemp shortmess showtabline slm spellcapcheck splitright ssop stmp swapfile sxq tabstop tal term titlelen toolbariconsize ttimeout ttymouse udir updatetime verbose virtualedit wc wh wildcharm wim winminheight wmh wrapscan ww syn keyword vimOption contained altkeymap arabic autowrite backupcopy bdir bin bomb bt ccv charconvert cinoptions cms comments conceallevel cpo cscopequickfix csqf cursorbind define diffexpr dy ef eol esckeys fcs fdn ff fileignorecase fmr foldlevel foldtext fsync gfs gtl guioptions hf hk hlsearch imactivatekey imi include inex isi js kp linebreak lm lz matchpairs maxmemtot mkspellmem mod mousef mouset nf pa path pheader previewheight printmbcharset pvw regexpengine rightleft rtp sbo scrolljump sel shell shq sm so spellfile spr st sts swapsync syn tag tb termbidi tgst titleold top ttimeoutlen ttyscroll ul ur unnamedclip unc verbosefile visualbell " vimOptions: These are the turn-off setting variants {{{2 -syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobinary nobk nobuflisted nocin noconfirm nocopyindent nocscoperelative nocsre nocuc nocursorcolumn nodelcombine nodigraph noendofline noerrorbells noex nofen nofk nogd nohid nohkmap nohkp nohlsearch noicon noim noimcmdline noimdisable noinf noinsertmode nojoinspaces nolazyredraw nolinebreak nolist nolpl noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscs nosft noshelltemp noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup +syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobinary nobk nobuflisted nocin noconfirm nocopyindent nocscoperelative nocsre nocuc nocursorcolumn nodelcombine nodigraph noendofline noerrorbells noex nofen nofk nogd nohid nohkmap nohkp nohlsearch noicon noim noimcmdline noimdisable noinf noinsertmode nojoinspaces nolazyredraw nolinebreak nolist nolpl noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscs nosft noshelltemp noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbs noterse notextmode notgst notimeout noto notr notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup syn keyword vimOption contained noai noaltkeymap noar noarabicshape noautochdir noautowrite noawa nobeval nobl nocf nocindent nocp nocscopetag nocst nocul nocursorline nodg noea noeol noesckeys noexpandtab nofic nofkmap nogdefault nohidden nohkmapp nohls noic noignorecase noimc noimd noincsearch noinfercase nois nojs nolbr nolisp noloadplugins nolz nomacatsui nomh nomod nomodifiable nomore nomousefocus nonu noodev nopaste nopreserveindent noprompt noreadonly noremap norevins norightleft nornu nors noruler nosc noscrollbind nosecure noshellslash noshiftround noshowcmd noshowmatch nosi nosmartcase nosmarttab nospell nosplitright nosr nosta nostmp noswf notagbsearch notagstack notbidi notermbidi notextauto notildeop notitle notop nottimeout noudf novb nowa nowb nowfh nowic nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows syn keyword vimOption contained noakm noanti noarab noari noautoindent noautowriteall nobackup nobin nobomb noci nocompatible nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek noequalalways noet noexrc nofileignorecase nofoldenable noguipty nohk " vimOptions: These are the invertible variants {{{2 -syn keyword vimOption contained invacd invallowrevins invantialias invarabic invarshape invautoread invaw invballooneval invbinary invbk invbuflisted invcin invconfirm invcopyindent invcscoperelative invcsre invcuc invcursorcolumn invdelcombine invdigraph invendofline inverrorbells invex invfen invfk invgd invhid invhkmap invhkp invhlsearch invicon invim invimcmdline invimdisable invinf invinsertmode invjoinspaces invlazyredraw invlinebreak invlist invlpl invma invmagic invml invmodeline invmodified invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw invrelativenumber invrestorescreen invri invrl invro invru invsb invscb invscs invsft invshelltemp invshowfulltag invshowmode invsm invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbi invtbs invterse invtextmode invtgst invtimeout invto invtr invttybuiltin invtx invundofile invvisualbell invwarn invweirdinvert invwfw invwildignorecase invwinfixheight invwiv invwrap invwrite invwritebackup +syn keyword vimOption contained invacd invallowrevins invantialias invarabic invarshape invautoread invaw invballooneval invbinary invbk invbuflisted invcin invconfirm invcopyindent invcscoperelative invcsre invcuc invcursorcolumn invdelcombine invdigraph invendofline inverrorbells invex invfen invfk invgd invhid invhkmap invhkp invhlsearch invicon invim invimcmdline invimdisable invinf invinsertmode invjoinspaces invlazyredraw invlinebreak invlist invlpl invma invmagic invml invmodeline invmodified invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw invrelativenumber invrestorescreen invri invrl invro invru invsb invscb invscs invsft invshelltemp invshowfulltag invshowmode invsm invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbs invterse invtextmode invtgst invtimeout invto invtr invtx invundofile invvisualbell invwarn invweirdinvert invwfw invwildignorecase invwinfixheight invwiv invwrap invwrite invwritebackup syn keyword vimOption contained invai invaltkeymap invar invarabicshape invautochdir invautowrite invawa invbeval invbl invcf invcindent invcp invcscopetag invcst invcul invcursorline invdg invea inveol invesckeys invexpandtab invfic invfkmap invgdefault invhidden invhkmapp invhls invic invignorecase invimc invimd invincsearch invinfercase invis invjs invlbr invlisp invloadplugins invlz invmacatsui invmh invmod invmodifiable invmore invmousefocus invnu invodev invpaste invpreserveindent invprompt invreadonly invremap invrevins invrightleft invrnu invrs invruler invsc invscrollbind invsecure invshellslash invshiftround invshowcmd invshowmatch invsi invsmartcase invsmarttab invspell invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi invtermbidi invtextauto invtildeop invtitle invtop invttimeout invudf invvb invwa invwb invwfh invwic invwildmenu invwinfixwidth invwmnu invwrapscan invwriteany invws syn keyword vimOption contained invakm invanti invarab invari invautoindent invautowriteall invbackup invbin invbomb invci invcompatible invcrb invcscopeverbose invcsverb invcursorbind invdeco invdiff inveb invek invequalalways invet invexrc invfileignorecase invfoldenable invguipty invhk diff --git a/src/nvim/eval.c b/src/nvim/eval.c index ad2a0b2bb2..10e2027b00 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -9867,12 +9867,6 @@ static void f_has(typval_T *argvars, typval_T *rettv) #endif "arabic", "autocmd", -#if defined(SOME_BUILTIN_TCAPS) || defined(ALL_BUILTIN_TCAPS) - "builtin_terms", -# ifdef ALL_BUILTIN_TCAPS - "all_builtin_terms", -# endif -#endif #if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \ || defined(FEAT_GUI_W32) \ || defined(FEAT_GUI_MOTIF)) diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index d5f7a218f4..238beebf3e 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -10,6 +10,7 @@ * ex_getln.c: Functions for entering and editing an Ex command line. */ +#include <assert.h> #include <errno.h> #include <stdbool.h> #include <string.h> @@ -3858,8 +3859,10 @@ expand_shellcmd ( STRLCPY(buf + l, pat, MAXPATHL - l); /* Expand matches in one directory of $PATH. */ + char_u **prev_file = *file; ret = expand_wildcards(1, &buf, num_file, file, flags); if (ret == OK) { + assert(*file != prev_file); ga_grow(&ga, *num_file); { for (i = 0; i < *num_file; ++i) { diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 9d4c990f3a..799a6a2a50 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -7416,7 +7416,7 @@ long read_eintr(int fd, void *buf, size_t bufsize) long ret; for (;; ) { - ret = vim_read(fd, buf, bufsize); + ret = read(fd, buf, bufsize); if (ret >= 0 || errno != EINTR) break; } @@ -7435,7 +7435,7 @@ long write_eintr(int fd, void *buf, size_t bufsize) /* Repeat the write() so long it didn't fail, other than being interrupted * by a signal. */ while (ret < (long)bufsize) { - wlen = vim_write(fd, (char *)buf + ret, bufsize - ret); + wlen = write(fd, (char *)buf + ret, bufsize - ret); if (wlen < 0) { if (errno != EINTR) break; diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 5a577c6378..d6d7d3db1a 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -54,6 +54,7 @@ #include "nvim/cursor.h" #include "nvim/eval.h" #include "nvim/fileio.h" +#include "nvim/func_attr.h" #include "nvim/main.h" #include "nvim/mark.h" #include "nvim/mbyte.h" @@ -630,6 +631,15 @@ static int ml_check_b0_id(ZERO_BL *b0p) return OK; } +/// Return true if all strings in b0 are correct (nul-terminated). +static bool ml_check_b0_strings(ZERO_BL *b0p) FUNC_ATTR_NONNULL_ALL +{ + return (memchr(b0p->b0_version, NUL, 10) + && memchr(b0p->b0_uname, NUL, B0_UNAME_SIZE) + && memchr(b0p->b0_hname, NUL, B0_HNAME_SIZE) + && memchr(b0p->b0_fname, NUL, B0_FNAME_SIZE_CRYPT)); +} + /* * Update the timestamp or the B0_SAME_DIR flag of the .swp file. */ @@ -1522,6 +1532,8 @@ static time_t swapfile_info(char_u *fname) MSG_PUTS(_(" [from Vim version 3.0]")); } else if (ml_check_b0_id(&b0) == FAIL) { MSG_PUTS(_(" [does not look like a Vim swap file]")); + } else if (!ml_check_b0_strings(&b0)) { + MSG_PUTS(_(" [garbled strings (not nul terminated)]")); } else { MSG_PUTS(_(" file name: ")); if (b0.b0_fname[0] == NUL) diff --git a/src/nvim/os/pty_process.c b/src/nvim/os/pty_process.c index bd7247c741..c135efc6d3 100644 --- a/src/nvim/os/pty_process.c +++ b/src/nvim/os/pty_process.c @@ -20,6 +20,7 @@ #include <uv.h> +#include "nvim/func_attr.h" #include "nvim/os/job.h" #include "nvim/os/job_defs.h" #include "nvim/os/job_private.h" @@ -37,9 +38,10 @@ typedef struct { int tty_fd; } PtyProcess; -void pty_process_init(Job *job) +void pty_process_init(Job *job) FUNC_ATTR_NONNULL_ALL { PtyProcess *ptyproc = xmalloc(sizeof(PtyProcess)); + ptyproc->tty_fd = -1; if (job->opts.writable) { uv_pipe_init(uv_default_loop(), &ptyproc->proc_stdin, 0); @@ -62,14 +64,35 @@ void pty_process_init(Job *job) job->process = ptyproc; } -void pty_process_destroy(Job *job) +void pty_process_destroy(Job *job) FUNC_ATTR_NONNULL_ALL { free(job->opts.term_name); free(job->process); job->process = NULL; } -bool pty_process_spawn(Job *job) +static bool set_pipe_duplicating_descriptor(int fd, uv_pipe_t *pipe) + FUNC_ATTR_NONNULL_ALL +{ + int fd_dup = dup(fd); + if (fd_dup < 0) { + ELOG("Failed to dup descriptor %d: %s", fd, strerror(errno)); + return false; + } + int uv_result = uv_pipe_open(pipe, fd_dup); + if (uv_result) { + ELOG("Failed to set pipe to descriptor %d: %s", + fd_dup, uv_strerror(uv_result)); + close(fd_dup); + return false; + } + return true; +} + +static const unsigned int KILL_RETRIES = 5; +static const unsigned int KILL_TIMEOUT = 2; // seconds + +bool pty_process_spawn(Job *job) FUNC_ATTR_NONNULL_ALL { int master; PtyProcess *ptyproc = job->process; @@ -88,18 +111,29 @@ bool pty_process_spawn(Job *job) } // make sure the master file descriptor is non blocking - fcntl(master, F_SETFL, fcntl(master, F_GETFL) | O_NONBLOCK); + int master_status_flags = fcntl(master, F_GETFL); + if (master_status_flags == -1) { + ELOG("Failed to get master descriptor status flags: %s", strerror(errno)); + goto error; + } + if (fcntl(master, F_SETFL, master_status_flags | O_NONBLOCK) == -1) { + ELOG("Failed to make master descriptor non-blocking: %s", strerror(errno)); + goto error; + } - if (job->opts.writable) { - uv_pipe_open(&ptyproc->proc_stdin, dup(master)); + if (job->opts.writable + && !set_pipe_duplicating_descriptor(master, &ptyproc->proc_stdin)) { + goto error; } - if (job->opts.stdout_cb) { - uv_pipe_open(&ptyproc->proc_stdout, dup(master)); + if (job->opts.stdout_cb + && !set_pipe_duplicating_descriptor(master, &ptyproc->proc_stdout)) { + goto error; } - if (job->opts.stderr_cb) { - uv_pipe_open(&ptyproc->proc_stderr, dup(master)); + if (job->opts.stderr_cb + && !set_pipe_duplicating_descriptor(master, &ptyproc->proc_stderr)) { + goto error; } uv_signal_init(uv_default_loop(), &ptyproc->schld); @@ -108,25 +142,52 @@ bool pty_process_spawn(Job *job) ptyproc->tty_fd = master; job->pid = pid; return true; + +error: + close(master); + + // terminate spawned process + kill(pid, SIGTERM); + int status, child; + unsigned int try = 0; + while (try++ < KILL_RETRIES && !(child = waitpid(pid, &status, WNOHANG))) { + sleep(KILL_TIMEOUT); + } + if (child != pid) { + kill(pid, SIGKILL); + } + + return false; } -void pty_process_close(Job *job) +void pty_process_close(Job *job) FUNC_ATTR_NONNULL_ALL { PtyProcess *ptyproc = job->process; uv_signal_stop(&ptyproc->schld); uv_close((uv_handle_t *)&ptyproc->schld, NULL); + pty_process_close_master(job); job_close_streams(job); job_decref(job); } +void pty_process_close_master(Job *job) FUNC_ATTR_NONNULL_ALL +{ + PtyProcess *ptyproc = job->process; + if (ptyproc->tty_fd >= 0) { + close(ptyproc->tty_fd); + ptyproc->tty_fd = -1; + } +} + void pty_process_resize(Job *job, uint16_t width, uint16_t height) + FUNC_ATTR_NONNULL_ALL { PtyProcess *ptyproc = job->process; ptyproc->winsize = (struct winsize){height, width, 0, 0}; ioctl(ptyproc->tty_fd, TIOCSWINSZ, &ptyproc->winsize); } -static void init_child(Job *job) +static void init_child(Job *job) FUNC_ATTR_NONNULL_ALL { unsetenv("COLUMNS"); unsetenv("LINES"); @@ -146,7 +207,7 @@ static void init_child(Job *job) fprintf(stderr, "execvp failed: %s\n", strerror(errno)); } -static void chld_handler(uv_signal_t *handle, int signum) +static void chld_handler(uv_signal_t *handle, int signum) FUNC_ATTR_NONNULL_ALL { Job *job = handle->data; int stat = 0; @@ -171,7 +232,7 @@ static void chld_handler(uv_signal_t *handle, int signum) pty_process_close(job); } -static void init_termios(struct termios *termios) +static void init_termios(struct termios *termios) FUNC_ATTR_NONNULL_ALL { memset(termios, 0, sizeof(struct termios)); // Taken from pangoterm diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 3f9466fd7c..0da79cb8ae 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -319,7 +319,7 @@ static char msg_no_items[] = N_("No Syntax items defined for this buffer"); #define ID_LIST_ALL (short *)-1 /* valid of si_cont_list for containing all but contained groups */ -static int next_seqnr = 0; /* value to use for si_seqnr */ +static int next_seqnr = 1; /* value to use for si_seqnr */ /* * The next possible match in the current line for any pattern is remembered, diff --git a/src/nvim/version.c b/src/nvim/version.c index a957d844be..a5b62e5441 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -43,54 +43,14 @@ char *version_cflags = "Compilation: " NVIM_VERSION_CFLAGS; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "version.c.generated.h" #endif -static char *(features[]) = { + +static char *features[] = { #ifdef HAVE_ACL "+acl", #else // ifdef HAVE_ACL "-acl", #endif // ifdef HAVE_ACL - "+arabic", - "+autocmd", - "-browse", -#ifdef NO_BUILTIN_TCAPS - "-builtin_terms", -#endif // ifdef NO_BUILTIN_TCAPS -#ifdef SOME_BUILTIN_TCAPS - "+builtin_terms", -#endif // ifdef SOME_BUILTIN_TCAPS -#ifdef ALL_BUILTIN_TCAPS - "++builtin_terms", -#endif // ifdef ALL_BUILTIN_TCAPS - "+byte_offset", - "+cindent", - "-clipboard", - "+cmdline_compl", - "+cmdline_hist", - "+cmdline_info", - "+comments", - "+conceal", - "+cscope", - "+cursorbind", - "+cursorshape", - "+dialog_con", - "+digraphs", - "-dnd", - "-ebcdic", - "-emacs_tags", - "+eval", - "+ex_extra", - "+extra_search", - "+farsi", - "+file_in_path", - "+find_in_path", - "+folding", - "-footer", - // only interesting on Unix systems -#if defined(UNIX) - "+fork()", -#endif // if defined(UNIX) - "+gettext", #if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV) # ifdef DYNAMIC_ICONV "+iconv/dyn", @@ -102,82 +62,22 @@ static char *(features[]) = { "-iconv", #endif // if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) // || defined(DYNAMIC_ICONV) - "+insert_expand", - "+jumplist", - "+keymap", - "+langmap", - "+libcall", - "+linebreak", - "+lispindent", - "+listcmds", - "+localmap", - "+menu", - "+mksession", - "+modify_fname", - "+mouse", - "-mouseshape", - -#if defined(UNIX) - "+mouse_dec", - "-mouse_gpm", - "+mouse_netterm", -#endif // if defined(UNIX) - - -#if defined(UNIX) - "+mouse_sgr", - "-mouse_sysmouse", - "+mouse_urxvt", - "+mouse_xterm", -#endif // if defined(UNIX) - - "+multi_byte", - "+multi_lang", - "+path_extra", - "+persistent_undo", - "+postscript", - "+printer", - "+profile", - "+quickfix", - "+reltime", - "+rightleft", - "+scrollbind", - "+signs", - "+smartindent", - "+startuptime", - "+statusline", - "+syntax", - "+tag_binary", - "+tag_old_static", - "-tag_any_white", - "+termresponse", - "+textobjects", - "+title", - "-toolbar", - "+user_commands", - "+vertsplit", - "+virtualedit", - "+visual", - "+visualextra", - "+viminfo", - "+vreplace", - "+wildignore", - "+wildmenu", - "+windows", - "+writebackup", -#if defined(UNIX) - "-X11", -#endif // if defined(UNIX) - "-xfontset", -#if defined(UNIX) - "-xsmp", - "-xterm_clipboard", -#endif // if defined(UNIX) NULL }; // clang-format off static int included_patches[] = { + 673, + //672, + //671, + //670, + //669, + //668, + //667, + //666, + //665, + //664, + //663, //662, //661, 660, @@ -935,6 +835,7 @@ static void list_features(void) } } } + MSG_PUTS("For differences from Vim, see :help vim-differences\n\n"); } void list_version(void) @@ -976,7 +877,7 @@ void list_version(void) } #endif // ifdef HAVE_PATHDEF - version_msg(_(" Features included (+) or not (-):\n")); + version_msg(_("\n\nOptional features included (+) or not (-): ")); list_features(); diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 29d61dcbde..410c2602c8 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -322,13 +322,10 @@ enum { (size_t)(n)) #ifndef EINTR -# define read_eintr(fd, buf, count) vim_read((fd), (buf), (count)) -# define write_eintr(fd, buf, count) vim_write((fd), (buf), (count)) +# define read_eintr(fd, buf, count) read((fd), (buf), (count)) +# define write_eintr(fd, buf, count) write((fd), (buf), (count)) #endif -# define vim_read(fd, buf, count) read((fd), (char *)(buf), (size_t) (count)) -# define vim_write(fd, buf, count) write((fd), (char *)(buf), (size_t) (count)) - /* * Enums need a typecast to be used as array index (for Ultrix). */ |