merge upstream/master

This commit is contained in:
ckelsel 2017-07-16 08:22:49 +08:00
commit cb95f71f71
26 changed files with 325 additions and 185 deletions

View File

@ -33,7 +33,8 @@ function! health#check(plugin_names) abort
setlocal wrap breakindent
setlocal filetype=markdown
setlocal conceallevel=2 concealcursor=nc
setlocal keywordprg=:help iskeyword=@,48-57,_,192-255,-,#
setlocal keywordprg=:help
let &l:iskeyword='!-~,^*,^|,^",192-255'
call s:enhance_syntax()
if empty(healthchecks)

View File

@ -125,6 +125,10 @@ function! s:check_clipboard() abort
call health#report_warn(
\ 'No clipboard tool found. Clipboard registers will not work.',
\ [':help clipboard'])
elseif exists('g:clipboard') && (type({}) != type(g:clipboard)
\ || !has_key(g:clipboard, 'copy') || !has_key(g:clipboard, 'paste'))
call health#report_error(
\ 'g:clipboard exists but is malformed. It must be a dictionary with the keys documented at :help g:clipboard')
else
call health#report_ok('Clipboard tool found: '. clipboard_tool)
endif

View File

@ -137,16 +137,24 @@ function! s:clipboard.set(lines, regtype, reg) abort
let argv = split(s:copy[a:reg], " ")
let selection.detach = s:cache_enabled
let selection.cwd = "/"
call extend(selection, {
\ 'on_stdout': function('s:set_errhandler'),
\ 'on_stderr': function('s:set_errhandler'),
\ })
let jobid = jobstart(argv, selection)
if jobid <= 0
echohl WarningMsg
echo "clipboard: error when invoking provider"
echohl None
return 0
if jobid > 0
call jobsend(jobid, a:lines)
call jobclose(jobid, 'stdin')
let selection.owner = jobid
endif
endfunction
function! s:set_errhandler(job_id, data, event) abort
if a:job_id <= 0
echohl WarningMsg
echo 'clipboard: error when invoking provider: ' . join(a:data)
echohl None
endif
call jobsend(jobid, a:lines)
call jobclose(jobid, 'stdin')
let selection.owner = jobid
endfunction
function! provider#clipboard#Call(method, args) abort

View File

@ -249,8 +249,7 @@ Vi "the original". Without further remarks this is the version
of Vi that appeared in Sun OS 4.x. ":version" returns
"Version 3.7, 6/7/85". Sometimes other versions are referred
to. Only runs under Unix. Source code only available with a
license. More information on Vi can be found through:
http://vi-editor.org [doesn't currently work...]
license.
*Nvi*
Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.
Very good compatibility with the original Vi, with a few extensions.

View File

@ -102,36 +102,30 @@ function. Here's a more object-oriented version of the above:
>
let Shell = {}
function Shell.on_stdout(job_id, data) dict
call append(line('$'), self.get_name().' stdout: '.join(a:data))
function Shell.on_stdout(_job_id, data, event)
call append(line('$'),
\ printf('[%s] %s: %s', a:event, self.name, join(a:data[:-2])))
endfunction
function Shell.on_stderr(job_id, data) dict
call append(line('$'), self.get_name().' stderr: '.join(a:data))
let Shell.on_stderr = function(Shell.on_stdout)
function Shell.on_exit(job_id, _data, event)
let msg = printf('job %d ("%s") finished', a:job_id, self.name)
call append(line('$'), printf('[%s] BOOM!', a:event))
call append(line('$'), printf('[%s] %s!', a:event, msg))
endfunction
function Shell.on_exit(job_id, data) dict
call append(line('$'), self.get_name().' exited')
function Shell.new(name, cmd)
let object = extend(copy(g:Shell), {'name': a:name})
let object.cmd = ['sh', '-c', a:cmd]
let object.id = jobstart(object.cmd, object)
$
return object
endfunction
function Shell.get_name() dict
return 'shell '.self.name
endfunction
function Shell.new(name, ...) dict
let instance = extend(copy(g:Shell), {'name': a:name})
let argv = ['bash']
if a:0 > 0
let argv += ['-c', a:1]
endif
let instance.id = jobstart(argv, instance)
return instance
endfunction
let s1 = Shell.new('1')
let s2 = Shell.new('2', 'for i in {1..10}; do echo hello $i!; sleep 1; done')
let instance = Shell.new('bomb',
\ 'for i in $(seq 9 -1 1); do echo $i 1>&$((i % 2 + 1)); sleep 1; done')
<
To send data to the job's stdin, one can use the |jobsend()| function, like
this:
>

View File

@ -6,6 +6,8 @@
Nvim *nvim* *nvim-intro*
Nvim is based on Vim by Bram Moolenaar.
If you are new to Vim see |help.txt|, or type ":Tutor".
If you already use Vim see |nvim-from-vim| for a quickstart.

View File

@ -310,7 +310,7 @@ list_vim_patches() {
# Get missing Vim commits
local vim_commits
vim_commits="$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v7.4.1979..HEAD)"
vim_commits="$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v8.0.0000..HEAD)"
local vim_commit
for vim_commit in ${vim_commits}; do
@ -320,6 +320,7 @@ list_vim_patches() {
vim_tag="$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null)" || true
if [[ -n "${vim_tag}" ]]; then
local patch_number="${vim_tag:5}" # Remove prefix like "v7.4."
patch_number="$(echo ${patch_number} | sed 's/^0*//g')" # Remove prefix "0"
# Tagged Vim patch, check version.c:
is_missing="$(sed -n '/static const int included_patches/,/}/p' "${NVIM_SOURCE_DIR}/src/nvim/version.c" |
grep -x -e "[[:space:]]*//[[:space:]]${patch_number} NA.*" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")"

View File

@ -91,6 +91,57 @@ static char *e_auabort = N_("E855: Autocommands caused command to abort");
// Number of times free_buffer() was called.
static int buf_free_count = 0;
// Read data from buffer for retrying.
static int
read_buffer(
int read_stdin, // read file from stdin, otherwise fifo
exarg_T *eap, // for forced 'ff' and 'fenc' or NULL
int flags) // extra flags for readfile()
{
int retval = OK;
linenr_T line_count;
//
// Read from the buffer which the text is already filled in and append at
// the end. This makes it possible to retry when 'fileformat' or
// 'fileencoding' was guessed wrong.
//
line_count = curbuf->b_ml.ml_line_count;
retval = readfile(
read_stdin ? NULL : curbuf->b_ffname,
read_stdin ? NULL : curbuf->b_fname,
(linenr_T)line_count, (linenr_T)0, (linenr_T)MAXLNUM, eap,
flags | READ_BUFFER);
if (retval == OK) {
// Delete the binary lines.
while (--line_count >= 0) {
ml_delete((linenr_T)1, false);
}
} else {
// Delete the converted lines.
while (curbuf->b_ml.ml_line_count > line_count) {
ml_delete(line_count, false);
}
}
// Put the cursor on the first line.
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
if (read_stdin) {
// Set or reset 'modified' before executing autocommands, so that
// it can be changed there.
if (!readonlymode && !bufempty()) {
changed();
} else if (retval != FAIL) {
unchanged(curbuf, false);
}
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, false,
curbuf, &retval);
}
return retval;
}
/*
* Open current buffer, that is: open the memfile and read the file into
* memory.
@ -106,6 +157,7 @@ open_buffer (
int retval = OK;
bufref_T old_curbuf;
long old_tw = curbuf->b_p_tw;
int read_fifo = false;
/*
* The 'readonly' flag is only set when BF_NEVERLOADED is being reset.
@ -156,13 +208,45 @@ open_buffer (
if (curbuf->b_ffname != NULL) {
int old_msg_silent = msg_silent;
#ifdef UNIX
int save_bin = curbuf->b_p_bin;
int perm;
perm = os_getperm((const char *)curbuf->b_ffname);
if (perm >= 0 && (0
# ifdef S_ISFIFO
|| S_ISFIFO(perm)
# endif
# ifdef S_ISSOCK
|| S_ISSOCK(perm)
# endif
# ifdef OPEN_CHR_FILES
|| (S_ISCHR(perm)
&& is_dev_fd_file(curbuf->b_ffname))
# endif
)
) {
read_fifo = true;
}
if (read_fifo) {
curbuf->b_p_bin = true;
}
#endif
if (shortmess(SHM_FILEINFO)) {
msg_silent = 1;
}
retval = readfile(curbuf->b_ffname, curbuf->b_fname,
(linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, eap,
flags | READ_NEW);
flags | READ_NEW | (read_fifo ? READ_FIFO : 0));
#ifdef UNIX
if (read_fifo) {
curbuf->b_p_bin = save_bin;
if (retval == OK) {
retval = read_buffer(false, eap, flags);
}
}
#endif
msg_silent = old_msg_silent;
// Help buffer is filtered.
@ -171,7 +255,6 @@ open_buffer (
}
} else if (read_stdin) {
int save_bin = curbuf->b_p_bin;
linenr_T line_count;
/*
* First read the text in binary mode into the buffer.
@ -185,41 +268,13 @@ open_buffer (
flags | (READ_NEW + READ_STDIN));
curbuf->b_p_bin = save_bin;
if (retval == OK) {
line_count = curbuf->b_ml.ml_line_count;
retval = readfile(NULL, NULL, (linenr_T)line_count,
(linenr_T)0, (linenr_T)MAXLNUM, eap,
flags | READ_BUFFER);
if (retval == OK) {
/* Delete the binary lines. */
while (--line_count >= 0)
ml_delete((linenr_T)1, FALSE);
} else {
/* Delete the converted lines. */
while (curbuf->b_ml.ml_line_count > line_count)
ml_delete(line_count, FALSE);
}
/* Put the cursor on the first line. */
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
// Set or reset 'modified' before executing autocommands, so that
// it can be changed there.
if (!readonlymode && !bufempty()) {
changed();
} else if (retval == OK) {
unchanged(curbuf, false);
}
if (retval == OK) {
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, false,
curbuf, &retval);
}
retval = read_buffer(true, eap, flags);
}
}
/* if first time loading this buffer, init b_chartab[] */
if (curbuf->b_flags & BF_NEVERLOADED) {
(void)buf_init_chartab(curbuf, FALSE);
(void)buf_init_chartab(curbuf, false);
parse_cino(curbuf);
}
@ -234,7 +289,7 @@ open_buffer (
|| modified_was_set // ":set modified" used in autocmd
|| (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)) {
changed();
} else if (retval == OK && !read_stdin) {
} else if (retval != FAIL && !read_stdin && !read_fifo) {
unchanged(curbuf, false);
}
save_file_ff(curbuf); // keep this fileformat
@ -416,8 +471,8 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
return;
}
/* When the buffer becomes hidden, but is not unloaded, trigger
* BufHidden */
// When the buffer becomes hidden, but is not unloaded, trigger
// BufHidden
if (!unload_buf) {
buf->b_locked++;
if (apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname, false,

View File

@ -12451,7 +12451,7 @@ static void f_matchadd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (id >= 1 && id <= 3) {
EMSGN("E798: ID is reserved for \":match\": %" PRId64, id);
EMSGN(_("E798: ID is reserved for \":match\": %" PRId64), id);
return;
}
@ -12508,7 +12508,7 @@ static void f_matchaddpos(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// id == 3 is ok because matchaddpos() is supposed to substitute :3match
if (id == 1 || id == 2) {
EMSGN("E798: ID is reserved for \"match\": %" PRId64, id);
EMSGN(_("E798: ID is reserved for \"match\": %" PRId64), id);
return;
}

View File

@ -5023,8 +5023,9 @@ static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname,
if (gen_expand_wildcards(1, buff_list, &filecount, &files,
EW_FILE|EW_SILENT) == FAIL
|| filecount == 0) {
if (!got_int)
EMSG2("E151: No match: %s", NameBuff);
if (!got_int) {
EMSG2(_("E151: No match: %s"), NameBuff);
}
return;
}
@ -5223,7 +5224,7 @@ static void do_helptags(char_u *dirname, bool add_help_tags)
if (gen_expand_wildcards(1, buff_list, &filecount, &files,
EW_FILE|EW_SILENT) == FAIL
|| filecount == 0) {
EMSG2("E151: No match: %s", NameBuff);
EMSG2(_("E151: No match: %s"), NameBuff);
xfree(dirname);
return;
}

View File

@ -247,6 +247,7 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr)
* stdin)
* READ_DUMMY read into a dummy buffer (to check if file contents changed)
* READ_KEEP_UNDO don't clear undo info or read it from a file
* READ_FIFO read from fifo/socket instead of a file
*
* return FAIL for failure, NOTDONE for directory (failure), or OK
*/
@ -267,6 +268,7 @@ readfile (
int filtering = (flags & READ_FILTER);
int read_stdin = (flags & READ_STDIN);
int read_buffer = (flags & READ_BUFFER);
int read_fifo = (flags & READ_FIFO);
int set_options = newfile || read_buffer
|| (eap != NULL && eap->read_edit);
linenr_T read_buf_lnum = 1; /* next line to read from curbuf */
@ -426,7 +428,7 @@ readfile (
}
}
if (!read_buffer && !read_stdin) {
if (!read_buffer && !read_stdin && !read_fifo) {
perm = os_getperm((const char *)fname);
#ifdef UNIX
// On Unix it is possible to read a directory, so we have to
@ -468,8 +470,8 @@ readfile (
if (check_readonly && !readonlymode)
curbuf->b_p_ro = FALSE;
if (newfile && !read_stdin && !read_buffer) {
/* Remember time of file. */
if (newfile && !read_stdin && !read_buffer && !read_fifo) {
// Remember time of file.
FileInfo file_info;
if (os_fileinfo((char *)fname, &file_info)) {
buf_store_file_info(curbuf, &file_info);
@ -895,6 +897,7 @@ retry:
* and we can't do it internally or with iconv().
*/
if (fio_flags == 0 && !read_stdin && !read_buffer && *p_ccv != NUL
&& !read_fifo
# ifdef USE_ICONV
&& iconv_fd == (iconv_t)-1
# endif
@ -935,7 +938,7 @@ retry:
/* Set "can_retry" when it's possible to rewind the file and try with
* another "fenc" value. It's FALSE when no other "fenc" to try, reading
* stdin or fixed at a specific encoding. */
can_retry = (*fenc != NUL && !read_stdin && !keep_dest_enc);
can_retry = (*fenc != NUL && !read_stdin && !keep_dest_enc && !read_fifo);
if (!skip_read) {
linerest = 0;
@ -947,6 +950,7 @@ retry:
&& curbuf->b_ffname != NULL
&& curbuf->b_p_udf
&& !filtering
&& !read_fifo
&& !read_stdin
&& !read_buffer);
if (read_undo_file)
@ -1919,7 +1923,7 @@ failed:
u_read_undo(NULL, hash, fname);
}
if (!read_stdin && !read_buffer) {
if (!read_stdin && !read_fifo && (!read_buffer || sfname != NULL)) {
int m = msg_scroll;
int n = msg_scrolled;
@ -1937,7 +1941,7 @@ failed:
if (filtering) {
apply_autocmds_exarg(EVENT_FILTERREADPOST, NULL, sfname,
false, curbuf, eap);
} else if (newfile) {
} else if (newfile || (read_buffer && sfname != NULL)) {
apply_autocmds_exarg(EVENT_BUFREADPOST, NULL, sfname,
false, curbuf, eap);
if (!au_did_filetype && *curbuf->b_p_ft != NUL) {
@ -1970,7 +1974,7 @@ failed:
/// Do not accept "/dev/fd/[012]", opening these may hang Vim.
///
/// @param fname file name to check
static bool is_dev_fd_file(char_u *fname)
bool is_dev_fd_file(char_u *fname)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
return STRNCMP(fname, "/dev/fd/", 8) == 0

View File

@ -4,13 +4,14 @@
#include "nvim/buffer_defs.h"
#include "nvim/os/os.h"
/* Values for readfile() flags */
#define READ_NEW 0x01 /* read a file into a new buffer */
#define READ_FILTER 0x02 /* read filter output */
#define READ_STDIN 0x04 /* read from stdin */
#define READ_BUFFER 0x08 /* read from curbuf (converting stdin) */
#define READ_DUMMY 0x10 /* reading into a dummy buffer */
#define READ_KEEP_UNDO 0x20 /* keep undo info*/
// Values for readfile() flags
#define READ_NEW 0x01 // read a file into a new buffer
#define READ_FILTER 0x02 // read filter output
#define READ_STDIN 0x04 // read from stdin
#define READ_BUFFER 0x08 // read from curbuf (converting stdin)
#define READ_DUMMY 0x10 // reading into a dummy buffer
#define READ_KEEP_UNDO 0x20 // keep undo info
#define READ_FIFO 0x40 // read from fifo or socket
#define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y))

View File

@ -3913,7 +3913,7 @@ addstate (
int k;
int found = FALSE;
nfa_thread_T *thread;
lpos_T save_lpos;
struct multipos save_multipos;
int save_in_use;
char_u *save_ptr;
int i;
@ -4127,15 +4127,13 @@ skip_add:
/* avoid compiler warnings */
save_ptr = NULL;
save_lpos.lnum = 0;
save_lpos.col = 0;
memset(&save_multipos, 0, sizeof(save_multipos));
/* Set the position (with "off" added) in the subexpression. Save
* and restore it when it was in use. Otherwise fill any gap. */
if (REG_MULTI) {
if (subidx < sub->in_use) {
save_lpos.lnum = sub->list.multi[subidx].start_lnum;
save_lpos.col = sub->list.multi[subidx].start_col;
save_multipos = sub->list.multi[subidx];
save_in_use = -1;
} else {
save_in_use = sub->in_use;
@ -4178,9 +4176,8 @@ skip_add:
sub = &subs->norm;
if (save_in_use == -1) {
if (REG_MULTI){
sub->list.multi[subidx].start_lnum = save_lpos.lnum;
sub->list.multi[subidx].start_col = save_lpos.col;
if (REG_MULTI) {
sub->list.multi[subidx] = save_multipos;
}
else
sub->list.line[subidx].start = save_ptr;
@ -4234,8 +4231,7 @@ skip_add:
if (sub->in_use <= subidx)
sub->in_use = subidx + 1;
if (REG_MULTI) {
save_lpos.lnum = sub->list.multi[subidx].end_lnum;
save_lpos.col = sub->list.multi[subidx].end_col;
save_multipos = sub->list.multi[subidx];
if (off == -1) {
sub->list.multi[subidx].end_lnum = reglnum + 1;
sub->list.multi[subidx].end_col = 0;
@ -4249,9 +4245,8 @@ skip_add:
} else {
save_ptr = sub->list.line[subidx].end;
sub->list.line[subidx].end = reginput + off;
/* avoid compiler warnings */
save_lpos.lnum = 0;
save_lpos.col = 0;
// avoid compiler warnings
memset(&save_multipos, 0, sizeof(save_multipos));
}
subs = addstate(l, state->out, subs, pim, off_arg);
@ -4261,9 +4256,8 @@ skip_add:
else
sub = &subs->norm;
if (REG_MULTI){
sub->list.multi[subidx].end_lnum = save_lpos.lnum;
sub->list.multi[subidx].end_col = save_lpos.col;
if (REG_MULTI) {
sub->list.multi[subidx] = save_multipos;
}
else
sub->list.line[subidx].end = save_ptr;

View File

@ -2068,7 +2068,7 @@ char_u *did_set_spelllang(win_T *wp)
// destroying the buffer we are using...
if (!bufref_valid(&bufref)) {
ret_msg =
(char_u *)"E797: SpellFileMissing autocommand deleted buffer";
(char_u *)N_("E797: SpellFileMissing autocommand deleted buffer");
goto theend;
}
}

View File

@ -62,6 +62,8 @@ NEW_TESTS ?= \
test_signs.res \
test_smartindent.res \
test_stat.res \
test_startup.res \
test_startup_utf8.res \
test_substitute.res \
test_syntax.res \
test_tabpage.res \

View File

@ -98,6 +98,21 @@ func Test_recursive_substitute()
bwipe!
endfunc
func Test_nested_backrefs()
" Check example in change.txt.
new
for re in range(0, 2)
exe 'set re=' . re
call setline(1, 'aa ab x')
1s/\(\(a[a-d] \)*\)\(x\)/-\1- -\2- -\3-/
call assert_equal('-aa ab - -ab - -x-', getline(1))
call assert_equal('-aa ab - -ab - -x-', substitute('aa ab x', '\(\(a[a-d] \)*\)\(x\)', '-\1- -\2- -\3-', ''))
endfor
bwipe!
set re=0
endfunc
func Test_eow_with_optional()
let expected = ['abc def', 'abc', 'def', '', '', '', '', '', '', '']
for re in range(0, 2)

View File

@ -75,7 +75,7 @@ func Test_help_arg()
" check if couple of lines are there
let found = []
for line in lines
if line =~ '-R.*Readonly mode'
if line =~ '-R.*Read-only mode'
call add(found, 'Readonly mode')
endif
" Watch out for a second --version line in the Gnome version.

View File

@ -0,0 +1,64 @@
" Tests for startup using utf-8.
if !has('multi_byte')
finish
endif
source shared.vim
func Test_read_stdin_utf8()
let linesin = ['テスト', '€ÀÈÌÒÙ']
call writefile(linesin, 'Xtestin')
let before = [
\ 'set enc=utf-8',
\ 'set fencs=cp932,utf-8',
\ ]
let after = [
\ 'write ++enc=utf-8 Xtestout',
\ 'quit!',
\ ]
if has('win32')
let pipecmd = 'type Xtestin | '
else
let pipecmd = 'cat Xtestin | '
endif
if RunVimPiped(before, after, '-', pipecmd)
let lines = readfile('Xtestout')
call assert_equal(linesin, lines)
else
call assert_equal('', 'RunVimPiped failed.')
endif
call delete('Xtestout')
call delete('Xtestin')
endfunc
func Test_read_fifo_utf8()
if !has('unix')
return
endif
" Using bash/zsh's process substitution.
if executable('bash')
set shell=bash
elseif executable('zsh')
set shell=zsh
else
return
endif
let linesin = ['テスト', '€ÀÈÌÒÙ']
call writefile(linesin, 'Xtestin')
let before = [
\ 'set enc=utf-8',
\ 'set fencs=cp932,utf-8',
\ ]
let after = [
\ 'write ++enc=utf-8 Xtestout',
\ 'quit!',
\ ]
if RunVim(before, after, '<(cat Xtestin)')
let lines = readfile('Xtestout')
call assert_equal(linesin, lines)
else
call assert_equal('', 'RunVim failed.')
endif
call delete('Xtestout')
call delete('Xtestin')
endfunc

View File

@ -1236,18 +1236,6 @@ static int unibi_find_ext_str(unibi_term *ut, const char *name)
return -1;
}
static int unibi_find_ext_bool(unibi_term *ut, const char *name)
{
size_t max = unibi_count_ext_bool(ut);
for (size_t i = 0; i < max; i++) {
const char * n = unibi_get_ext_bool_name(ut, i);
if (n && 0 == strcmp(n, name)) {
return (int)i;
}
}
return -1;
}
/// Several entries in terminfo are known to be deficient or outright wrong,
/// unfortunately; and several terminal emulators falsely announce incorrect
/// terminal types. So patch the terminfo records after loading from an
@ -1389,14 +1377,21 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
// No bugs in the vanilla terminfo for our purposes.
}
#define XTERM_SETAF_256 \
// At this time (2017-07-12) it seems like all terminals that support 256
// color codes can use semicolons in the terminal code and be fine.
// However, this is not correct according to the spec. So to reward those
// terminals that also support colons, we output the code that way on these
// specific ones.
// using colons like ISO 8613-6:1994/ITU T.416:1993 says.
#define XTERM_SETAF_256_COLON \
"\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38:5:%p1%d%;m"
#define XTERM_SETAB_256 \
#define XTERM_SETAB_256_COLON \
"\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48:5:%p1%d%;m"
// "standard" means using colons like ISO 8613-6:1994/ITU T.416:1993 says.
#define XTERM_SETAF_256_NONSTANDARD \
#define XTERM_SETAF_256 \
"\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"
#define XTERM_SETAB_256_NONSTANDARD \
#define XTERM_SETAB_256 \
"\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"
#define XTERM_SETAF_16 \
"\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e39%;m"
@ -1410,8 +1405,8 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
// more on this.
if (true_xterm || iterm || iterm_pretending_xterm) {
unibi_set_num(ut, unibi_max_colors, 256);
unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF_256);
unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB_256);
unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF_256_COLON);
unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB_256_COLON);
} else if (konsole || xterm || gnome || rxvt || st || putty
|| linuxvt // Linux 4.8+ supports 256-colour SGR.
|| mate_pretending_xterm || gnome_pretending_xterm
@ -1420,8 +1415,8 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
|| (term && strstr(term, "256"))
) {
unibi_set_num(ut, unibi_max_colors, 256);
unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF_256_NONSTANDARD);
unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB_256_NONSTANDARD);
unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF_256);
unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB_256);
}
}
// Terminals where there is actually 16-colour SGR support despite what
@ -1536,26 +1531,20 @@ static void augment_terminfo(TUIData *data, const char *term,
const char *colorterm, long vte_version, bool konsole, bool iterm_env)
{
unibi_term *ut = data->ut;
const char * xterm_version = os_getenv("XTERM_VERSION");
bool xterm = terminfo_is_term_family(term, "xterm");
bool dtterm = terminfo_is_term_family(term, "dtterm");
bool linuxvt = terminfo_is_term_family(term, "linux");
bool rxvt = terminfo_is_term_family(term, "rxvt");
bool teraterm = terminfo_is_term_family(term, "teraterm");
bool putty = terminfo_is_term_family(term, "putty");
bool screen = terminfo_is_term_family(term, "screen");
bool tmux = terminfo_is_term_family(term, "tmux");
bool st = terminfo_is_term_family(term, "st");
bool gnome = terminfo_is_term_family(term, "gnome")
|| terminfo_is_term_family(term, "vte");
bool iterm = terminfo_is_term_family(term, "iterm")
|| terminfo_is_term_family(term, "iTerm.app");
// None of the following work over SSH; see :help TERM .
bool iterm_pretending_xterm = xterm && iterm_env;
bool true_xterm = xterm && !!xterm_version;
bool tmux_wrap = screen && !!os_getenv("TMUX");
bool old_truecolor_env = colorterm
&& (0 == strcmp(colorterm, "truecolor") || 0 == strcmp(colorterm, "24bit"));
const char * xterm_version = os_getenv("XTERM_VERSION");
bool true_xterm = xterm && !!xterm_version;
// Only define this capability for terminal types that we know understand it.
if (dtterm // originated this extension
@ -1576,40 +1565,37 @@ static void augment_terminfo(TUIData *data, const char *term,
// them to terminal types, that do actually have such control sequences but
// lack the correct definitions in terminfo, is an augmentation, not a
// fixup. See https://gist.github.com/XVilka/8346728 for more about this.
int Tc = unibi_find_ext_bool(ut, "Tc");
// "standard" means using colons like ISO 8613-6:1994/ITU T.416:1993 says.
bool has_standard_rgb = false
// At this time (2017-07-12) it seems like all terminals that support rgb
// color codes can use semicolons in the terminal code and be fine.
// However, this is not correct according to the spec. So to reward those
// terminals that also support colons, we output the code that way on these
// specific ones.
// can use colons like ISO 8613-6:1994/ITU T.416:1993 says.
bool has_colon_rgb = false
// per GNOME bug #685759 and bug #704449
|| ((gnome || xterm) && (vte_version >= 3600))
|| (vte_version >= 3600)
|| iterm || iterm_pretending_xterm // per analysis of VT100Terminal.m
// per http://invisible-island.net/xterm/xterm.log.html#xterm_282
|| true_xterm;
bool has_non_standard_rgb = -1 != Tc
// terminfo is definitive if it says something.
? unibi_get_ext_bool(ut, (size_t)Tc)
: linuxvt // Linux 4.8+ supports true-colour SGR.
|| konsole // per commentary in VT102Emulation.cpp
// per http://lists.schmorp.de/pipermail/rxvt-unicode/2016q2/002261.html
|| rxvt
|| tmux // per experimentation
|| st // per experimentation
|| old_truecolor_env;
data->unibi_ext.set_rgb_foreground = unibi_find_ext_str(ut, "setrgbf");
if (-1 == data->unibi_ext.set_rgb_foreground) {
if (has_standard_rgb) {
if (has_colon_rgb) {
data->unibi_ext.set_rgb_foreground = (int)unibi_add_ext_str(ut, "setrgbf",
"\x1b[38:2:%p1%d:%p2%d:%p3%dm");
} else if (has_non_standard_rgb) {
} else {
data->unibi_ext.set_rgb_foreground = (int)unibi_add_ext_str(ut, "setrgbf",
"\x1b[38;2;%p1%d;%p2%d;%p3%dm");
}
}
data->unibi_ext.set_rgb_background = unibi_find_ext_str(ut, "setrgbb");
if (-1 == data->unibi_ext.set_rgb_background) {
if (has_standard_rgb) {
if (has_colon_rgb) {
data->unibi_ext.set_rgb_background = (int)unibi_add_ext_str(ut, "setrgbb",
"\x1b[48:2:%p1%d:%p2%d:%p3%dm");
} else if (has_non_standard_rgb) {
} else {
data->unibi_ext.set_rgb_background = (int)unibi_add_ext_str(ut, "setrgbb",
"\x1b[48;2;%p1%d;%p2%d;%p3%dm");
}
@ -1621,7 +1607,9 @@ static void augment_terminfo(TUIData *data, const char *term,
// would use a tmux control sequence and an extra if(screen) test.
data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str(
ut, NULL, TMUX_WRAP(tmux_wrap, "\033]Pl%p1%06x\033\\"));
} else if (xterm) {
} else if (xterm || (vte_version != 0) || rxvt) {
// This seems to be supported for a long time in VTE
// urxvt also supports this
data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str(
ut, NULL, "\033]12;#%p1%06x\007");
}

View File

@ -10,14 +10,14 @@ extern char* longVersion;
//
// Vim version number, name, etc. Patchlevel is defined in version.c.
//
#define VIM_VERSION_MAJOR 7
#define VIM_VERSION_MINOR 4
#define VIM_VERSION_MAJOR 8
#define VIM_VERSION_MINOR 0
#define VIM_VERSION_100 (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR)
// used for the runtime directory name
#define VIM_VERSION_NODOT "vim74"
#define VIM_VERSION_NODOT "vim80"
// swap file compatibility (max. length is 6 chars)
#define VIM_VERSION_SHORT "7.4"
#define VIM_VERSION_SHORT "8.0"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "version.h.generated.h"

View File

@ -319,4 +319,8 @@ enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext()
// Lowest number used for window ID. Cannot have this many windows per tab.
#define LOWEST_WIN_ID 1000
#if defined(__FreeBSD__) && defined(S_ISCHR)
# define OPEN_CHR_FILES
#endif
#endif /* NVIM_VIM_H */

View File

@ -5532,8 +5532,8 @@ int match_add(win_T *wp, const char *const grp, const char *const pat,
return -1;
}
if (id < -1 || id == 0) {
EMSGN("E799: Invalid ID: %" PRId64
" (must be greater than or equal to 1)",
EMSGN(_("E799: Invalid ID: %" PRId64
" (must be greater than or equal to 1)"),
id);
return -1;
}
@ -5541,7 +5541,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat,
cur = wp->w_match_head;
while (cur != NULL) {
if (cur->id == id) {
EMSGN("E801: ID already taken: %" PRId64, id);
EMSGN(_("E801: ID already taken: %" PRId64), id);
return -1;
}
cur = cur->next;
@ -5705,10 +5705,11 @@ int match_delete(win_T *wp, int id, int perr)
int rtype = SOME_VALID;
if (id < 1) {
if (perr == TRUE)
EMSGN("E802: Invalid ID: %" PRId64
" (must be greater than or equal to 1)",
if (perr) {
EMSGN(_("E802: Invalid ID: %" PRId64
" (must be greater than or equal to 1)"),
id);
}
return -1;
}
while (cur != NULL && cur->id != id) {
@ -5716,8 +5717,9 @@ int match_delete(win_T *wp, int id, int perr)
cur = cur->next;
}
if (cur == NULL) {
if (perr == TRUE)
EMSGN("E803: ID not found: %" PRId64, id);
if (perr) {
EMSGN(_("E803: ID not found: %" PRId64), id);
}
return -1;
}
if (cur == prev)

View File

@ -70,7 +70,7 @@ describe('health.vim', function()
health#broken#check
========================================================================
- ERROR: Failed to run healthcheck for "broken" plugin. Exception:
function health#check[20]..health#broken#check, line 1
function health#check[21]..health#broken#check, line 1
caused an error
]])
end)

View File

@ -2076,13 +2076,14 @@ describe('In autoload/shada.vim', function()
end
it('works', function()
local version = nvim('get_vvar', 'version')
getbstrings_eq({{timestamp='current', type=1, value={
generator='shada.vim',
version=704,
version=version,
}}}, {})
getbstrings_eq({
{timestamp='current', type=1, value={
generator='shada.vim', version=704
generator='shada.vim', version=version
}},
{timestamp=0, type=1, value={generator='test'}}
}, {
@ -2093,11 +2094,11 @@ describe('In autoload/shada.vim', function()
nvim('set_var', 'shada#add_own_header', 1)
getbstrings_eq({{timestamp='current', type=1, value={
generator='shada.vim',
version=704,
version=version,
}}}, {})
getbstrings_eq({
{timestamp='current', type=1, value={
generator='shada.vim', version=704
generator='shada.vim', version=version
}},
{timestamp=0, type=1, value={generator='test'}}
}, {

View File

@ -13,9 +13,6 @@ describe('ui/mouse/input', function()
clear()
meths.set_option('mouse', 'a')
meths.set_option('listchars', 'eol:$')
-- set mousetime to very high value to ensure that even in valgrind/travis,
-- nvim will still pick multiple clicks
meths.set_option('mousetime', 5000)
screen = Screen.new(25, 5)
screen:attach()
screen:set_default_attr_ids({
@ -119,7 +116,6 @@ describe('ui/mouse/input', function()
sel = { bold=true },
fill = { reverse=true }
})
screen.timeout = 15000
end)
it('in tabline on filler space moves tab to the end', function()

View File

@ -110,8 +110,8 @@ if(WIN32)
set(LIBTERMKEY_URL https://github.com/equalsraf/libtermkey/archive/tb-windows.zip)
set(LIBTERMKEY_SHA256 c81e33e38662b151a49847ff4feef4f8c4b2a66f3e159a28b575cbc9bcd8ffea)
else()
set(LIBTERMKEY_URL http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.19.tar.gz)
set(LIBTERMKEY_SHA256 c505aa4cb48c8fa59c526265576b97a19e6ebe7b7da20f4ecaae898b727b48b7)
set(LIBTERMKEY_URL http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.20.tar.gz)
set(LIBTERMKEY_SHA256 6c0d87c94ab9915e76ecd313baec08dedf3bd56de83743d9aa923a081935d2f5)
endif()
set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/a9c7c6fd20fa35e0ad3e0e98901ca12dfca9c25c.tar.gz)
@ -133,8 +133,11 @@ set(WINTOOLS_SHA256 8bfce7e3a365721a027ce842f2ec1cf878f1726233c215c05964aac07300
set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.7/neovim-qt.zip)
set(WINGUI_SHA256 b548f6e4045f16a10163b0e433f05b115b2f877cb47c4eacbf80eaad1a8429ab)
set(WIN32YANK_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.3/win32yank.zip)
set(WIN32YANK_SHA256 b474439ed2854a9a24941d66970c7fcfece219401eaaa5ebc0ffcc962e69887a)
set(WIN32YANK_X86_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x86.zip)
set(WIN32YANK_X86_SHA256 62f34e5a46c5d4a7b3f3b512e1ff7b77fedd432f42581cbe825233a996eed62c)
set(WIN32YANK_X86_64_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x64.zip)
set(WIN32YANK_X86_64_SHA256 33a747a92da60fb65e668edbf7661d3d902411a2d545fe9dc08623cecd142a20)
set(WINPTY_URL https://github.com/rprichard/winpty/releases/download/0.4.2/winpty-0.4.2-msvc2015.zip)
set(WINPTY_SHA256 b465f2584ff394b3fe27c01aa1dcfc679583c1ee951d0e83de3f859d8b8305b8)
@ -189,18 +192,19 @@ if(WIN32)
GetBinaryDep(TARGET wintools
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${DEPS_INSTALL_DIR}/bin)
GetBinaryDep(TARGET win32yank
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy win32yank.exe ${DEPS_INSTALL_DIR}/bin)
GetBinaryDep(TARGET wingui
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory bin ${DEPS_INSTALL_DIR}/bin)
include(TargetArch)
GetBinaryDep(TARGET "win32yank_${TARGET_ARCH}"
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy win32yank.exe ${DEPS_INSTALL_DIR}/bin)
if("${TARGET_ARCH}" STREQUAL "X86_64")
set(TARGET_ARCH x64)
elseif(TARGET_ARCH STREQUAL "X86")
set(TARGET_ARCH ia32)
endif()
GetBinaryDep(TARGET winpty
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/bin
COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/winpty/${TARGET_ARCH}/bin/*