Merge pull request #12665 from janlazo/vim-8.2.1254

vim-patch:8.0.1774,8.1.{192,194,255,264,1202,2172,2340},8.2.{62,71,72,1004,1254,1259,1265,1267,1292,1295}
This commit is contained in:
Matthieu Coudron 2020-08-02 20:19:48 +02:00 committed by GitHub
commit 4ed5204bc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 1552 additions and 976 deletions

View File

@ -1111,6 +1111,9 @@ x A single character, with no special meaning, matches itself
*[:tab:]* [:tab:] the <Tab> character
*[:escape:]* [:escape:] the <Esc> character
*[:backspace:]* [:backspace:] the <BS> character
*[:ident:]* [:ident:] identifier character (same as "\i")
*[:keyword:]* [:keyword:] keyword character (same as "\k")
*[:fname:]* [:fname:] file name character (same as "\f")
The brackets in character class expressions are additional to the
brackets delimiting a collection. For example, the following is a
plausible pattern for a Unix filename: "[-./[:alnum:]_~]\+" That is,

View File

@ -84,6 +84,9 @@ au BufNewFile,BufRead *.gpr setf ada
" AHDL
au BufNewFile,BufRead *.tdf setf ahdl
" AIDL
au BufNewFile,BufRead *.aidl setf aidl
" AMPL
au BufNewFile,BufRead *.run setf ampl

View File

@ -3646,13 +3646,19 @@ int build_stl_str_hl(
}
}
if (n == curitem && group_start_userhl == group_end_userhl) {
// empty group
out_p = t;
group_len = 0;
// do not use the highlighting from the removed group
for (n = groupitems[groupdepth] + 1; n < curitem; n++) {
// do not use the highlighting from the removed group
if (items[n].type == Highlight) {
items[n].type = Empty;
}
// adjust the start position of TabPage to the next
// item position
if (items[n].type == TabPage) {
items[n].start = out_p;
}
}
}
}

View File

@ -9519,7 +9519,7 @@ static void f_split(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_list_alloc_ret(rettv, kListLenMayKnow);
if (typeerr) {
return;
goto theend;
}
regmatch_T regmatch = {
@ -9563,6 +9563,7 @@ static void f_split(typval_T *argvars, typval_T *rettv, FunPtr fptr)
vim_regfree(regmatch.regprog);
}
theend:
p_cpo = save_cpo;
}

View File

@ -300,6 +300,7 @@ readfile(
int skip_read = false;
context_sha256_T sha_ctx;
int read_undo_file = false;
int split = 0; // number of split lines
linenr_T linecnt;
int error = FALSE; /* errors encountered */
int ff_error = EOL_UNKNOWN; /* file format with errors */
@ -1013,8 +1014,21 @@ retry:
*/
{
if (!skip_read) {
size = 0x10000L; /* use buffer >= 64K */
// Use buffer >= 64K. Add linerest to double the size if the
// line gets very long, to avoid a lot of copying. But don't
// read more than 1 Mbyte at a time, so we can be interrupted.
size = 0x10000L + linerest;
if (size > 0x100000L) {
size = 0x100000L;
}
}
// Protect against the argument of lalloc() going negative.
if (size < 0 || size + linerest + 1 < 0 || linerest >= MAXCOL) {
split++;
*ptr = NL; // split line by inserting a NL
size = 1;
} else if (!skip_read) {
for (; size >= 10; size /= 2) {
new_buffer = verbose_try_malloc((size_t)size + (size_t)linerest + 1);
if (new_buffer) {
@ -1862,6 +1876,10 @@ failed:
STRCAT(IObuff, _("[CR missing]"));
c = TRUE;
}
if (split) {
STRCAT(IObuff, _("[long lines split]"));
c = true;
}
if (notconverted) {
STRCAT(IObuff, _("[NOT converted]"));
c = TRUE;

View File

@ -1271,7 +1271,11 @@ return {
deny_duplicates=true,
vi_def=true,
varname='p_isi',
defaults={if_true={vi="@,48-57,_,192-255"}}
defaults={
condition='WIN32',
if_true={vi="@,48-57,_,128-167,224-235"},
if_false={vi="@,48-57,_,192-255"}
}
},
{
full_name='iskeyword', abbreviation='isk',

View File

@ -3757,13 +3757,13 @@ static int qf_buf_add_line(buf_T *buf, linenr_T lnum, const qfline_T *qfp,
buf_T *errbuf;
if (qfp->qf_module != NULL) {
STRCPY(IObuff, qfp->qf_module);
STRLCPY(IObuff, qfp->qf_module, IOSIZE - 1);
len = (int)STRLEN(IObuff);
} else if (qfp->qf_fnum != 0
&& (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL
&& errbuf->b_fname != NULL) {
if (qfp->qf_type == 1) { // :helpgrep
STRLCPY(IObuff, path_tail(errbuf->b_fname), sizeof(IObuff));
STRLCPY(IObuff, path_tail(errbuf->b_fname), IOSIZE - 1);
} else {
// shorten the file name if not done already
if (errbuf->b_sfname == NULL
@ -3773,33 +3773,37 @@ static int qf_buf_add_line(buf_T *buf, linenr_T lnum, const qfline_T *qfp,
}
shorten_buf_fname(errbuf, dirname, false);
}
STRLCPY(IObuff, errbuf->b_fname, sizeof(IObuff));
STRLCPY(IObuff, errbuf->b_fname, IOSIZE - 1);
}
len = (int)STRLEN(IObuff);
} else {
len = 0;
}
IObuff[len++] = '|';
if (len < IOSIZE - 1) {
IObuff[len++] = '|';
}
if (qfp->qf_lnum > 0) {
snprintf((char *)IObuff + len, sizeof(IObuff), "%" PRId64,
snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), "%" PRId64,
(int64_t)qfp->qf_lnum);
len += (int)STRLEN(IObuff + len);
if (qfp->qf_col > 0) {
snprintf((char *)IObuff + len, sizeof(IObuff), " col %d", qfp->qf_col);
snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), " col %d",
qfp->qf_col);
len += (int)STRLEN(IObuff + len);
}
snprintf((char *)IObuff + len, sizeof(IObuff), "%s",
snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), "%s",
(char *)qf_types(qfp->qf_type, qfp->qf_nr));
len += (int)STRLEN(IObuff + len);
} else if (qfp->qf_pattern != NULL) {
qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len);
len += (int)STRLEN(IObuff + len);
}
IObuff[len++] = '|';
IObuff[len++] = ' ';
if (len < IOSIZE - 2) {
IObuff[len++] = '|';
IObuff[len++] = ' ';
}
// Remove newlines and leading whitespace from the text.
// For an unrecognized line keep the indent, the compiler may

File diff suppressed because it is too large Load Diff

View File

@ -72,6 +72,7 @@ struct regprog {
unsigned regflags;
unsigned re_engine; ///< Automatic, backtracking or NFA engine.
unsigned re_flags; ///< Second argument for vim_regcomp().
bool re_in_use; ///< prog is being executed
};
/*
@ -84,7 +85,8 @@ typedef struct {
regengine_T *engine;
unsigned regflags;
unsigned re_engine;
unsigned re_flags; ///< Second argument for vim_regcomp().
unsigned re_flags;
bool re_in_use;
int regstart;
char_u reganch;
@ -114,7 +116,8 @@ typedef struct {
regengine_T *engine;
unsigned regflags;
unsigned re_engine;
unsigned re_flags; ///< Second argument for vim_regcomp().
unsigned re_flags;
bool re_in_use;
nfa_state_T *start; // points into state[]

File diff suppressed because it is too large Load Diff

View File

@ -3068,10 +3068,12 @@ win_line (
}
// When still displaying '$' of change command, stop at cursor
if ((dollar_vcol >= 0 && wp == curwin
&& lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol
&& filler_todo <= 0)
|| (number_only && draw_state > WL_NR)) {
if (((dollar_vcol >= 0
&& wp == curwin
&& lnum == wp->w_cursor.lnum
&& vcol >= (long)wp->w_virtcol)
|| (number_only && draw_state > WL_NR))
&& filler_todo <= 0) {
grid_put_linebuf(grid, row, 0, col, -grid->Columns, wp->w_p_rl, wp,
wp->w_hl_attr_normal, false);
// Pretend we have finished updating the window. Except when
@ -3476,6 +3478,7 @@ win_line (
* Only do this when there is no syntax highlighting, the
* @Spell cluster is not used or the current syntax item
* contains the @Spell cluster. */
v = (long)(ptr - line);
if (has_spell && v >= word_end && v > cur_checked_col) {
spell_attr = 0;
if (!attr_pri) {

View File

@ -0,0 +1,11 @@
source shared.vim
source term_util.vim
" Command to check that making screendumps is supported.
" Caller must source screendump.vim
command CheckScreendump call CheckScreendump()
func CheckScreendump()
if !CanRunVimInTerminal()
throw 'Skipped: cannot make screendumps'
endif
endfunc

View File

@ -84,6 +84,11 @@ let &runtimepath .= ','.expand($BUILD_DIR).'/runtime/'
" Always use forward slashes.
set shellslash
if has('win32')
" avoid prompt that is long or contains a line break
let $PROMPT = '$P$G'
endif
" Prepare for calling test_garbagecollect_now().
let v:testing = 1

View File

@ -1,7 +1,7 @@
" Tests for the backup function
func Test_backup()
set backup backupdir=.
set backup backupdir=. backupskip=
new
call setline(1, ['line1', 'line2'])
:f Xbackup.txt
@ -12,13 +12,13 @@ func Test_backup()
let l = readfile('Xbackup.txt~')
call assert_equal(['line1', 'line2'], l)
bw!
set backup&vim backupdir&vim
set backup&vim backupdir&vim backupskip&vim
call delete('Xbackup.txt')
call delete('Xbackup.txt~')
endfunc
func Test_backup2()
set backup backupdir=.//
set backup backupdir=.// backupskip=
new
call setline(1, ['line1', 'line2', 'line3'])
:f Xbackup.txt
@ -29,16 +29,16 @@ func Test_backup2()
sp *Xbackup.txt~
call assert_equal(['line1', 'line2', 'line3'], getline(1,'$'))
let f=expand('%')
call assert_match('src%nvim%testdir%Xbackup.txt\~', f)
call assert_match('%testdir%Xbackup.txt\~', f)
bw!
bw!
call delete('Xbackup.txt')
call delete(f)
set backup&vim backupdir&vim
set backup&vim backupdir&vim backupskip&vim
endfunc
func Test_backup2_backupcopy()
set backup backupdir=.// backupcopy=yes
set backup backupdir=.// backupcopy=yes backupskip=
new
call setline(1, ['line1', 'line2', 'line3'])
:f Xbackup.txt
@ -49,10 +49,10 @@ func Test_backup2_backupcopy()
sp *Xbackup.txt~
call assert_equal(['line1', 'line2', 'line3'], getline(1,'$'))
let f=expand('%')
call assert_match('src%nvim%testdir%Xbackup.txt\~', f)
call assert_match('%testdir%Xbackup.txt\~', f)
bw!
bw!
call delete('Xbackup.txt')
call delete(f)
set backup&vim backupdir&vim backupcopy&vim
set backup&vim backupdir&vim backupcopy&vim backupskip&vim
endfunc

View File

@ -1,6 +1,7 @@
" Tests for diff mode
source shared.vim
source screendump.vim
source check.vim
func Test_diff_fold_sync()
enew!
@ -801,6 +802,34 @@ func Test_diff_closeoff()
enew!
endfunc
func Test_diff_rnu()
CheckScreendump
let content =<< trim END
call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
vnew
call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
vnew
call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
windo diffthis
setlocal number rnu foldcolumn=0
END
call writefile(content, 'Xtest_diff_rnu')
let buf = RunVimInTerminal('-S Xtest_diff_rnu', {})
call VerifyScreenDump(buf, 'Test_diff_rnu_01', {})
call term_sendkeys(buf, "j")
call VerifyScreenDump(buf, 'Test_diff_rnu_02', {})
call term_sendkeys(buf, "j")
call VerifyScreenDump(buf, 'Test_diff_rnu_03', {})
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_rnu')
endfunc
func Test_diff_and_scroll()
" this was causing an ml_get error
set ls=2

View File

@ -54,6 +54,7 @@ let s:filename_checks = {
\ 'acedb': ['file.wrm'],
\ 'ada': ['file.adb', 'file.ads', 'file.ada', 'file.gpr'],
\ 'ahdl': ['file.tdf'],
\ 'aidl': ['file.aidl'],
\ 'alsaconf': ['.asoundrc', '/usr/share/alsa/alsa.conf', '/etc/asound.conf'],
\ 'aml': ['file.aml'],
\ 'ampl': ['file.run'],

View File

@ -554,6 +554,33 @@ func s:test_xhelpgrep(cchar)
" This wipes out the buffer, make sure that doesn't cause trouble.
Xclose
" When the current window is vertically split, jumping to a help match
" should open the help window at the top.
only | enew
let w1 = win_getid()
vert new
let w2 = win_getid()
Xnext
let w3 = win_getid()
call assert_true(&buftype == 'help')
call assert_true(winnr() == 1)
" See jump_to_help_window() for details
let w2_width = winwidth(w2)
if w2_width != &columns && w2_width < 80
call assert_equal(['col', [['leaf', w3],
\ ['row', [['leaf', w2], ['leaf', w1]]]]], winlayout())
else
call assert_equal(['row', [['col', [['leaf', w3], ['leaf', w2]]],
\ ['leaf', w1]]] , winlayout())
endif
new | only
set buftype=help
set modified
call assert_fails('Xnext', 'E37:')
set nomodified
new | only
if a:cchar == 'l'
" When a help window is present, running :lhelpgrep should reuse the
" help window and not the current window

View File

@ -32,6 +32,9 @@ func Test_equivalence_re2()
endfunc
func s:classes_test()
if has('win32')
set iskeyword=@,48-57,_,192-255
endif
set isprint=@,161-255
call assert_equal('Motörhead', matchstr('Motörhead', '[[:print:]]\+'))
@ -51,6 +54,12 @@ func s:classes_test()
let tabchar = ''
let upperchars = ''
let xdigitchars = ''
let identchars = ''
let identchars1 = ''
let kwordchars = ''
let kwordchars1 = ''
let fnamechars = ''
let fnamechars1 = ''
let i = 1
while i <= 255
let c = nr2char(i)
@ -102,6 +111,24 @@ func s:classes_test()
if c =~ '[[:xdigit:]]'
let xdigitchars .= c
endif
if c =~ '[[:ident:]]'
let identchars .= c
endif
if c =~ '\i'
let identchars1 .= c
endif
if c =~ '[[:keyword:]]'
let kwordchars .= c
endif
if c =~ '\k'
let kwordchars1 .= c
endif
if c =~ '[[:fname:]]'
let fnamechars .= c
endif
if c =~ '\f'
let fnamechars1 .= c
endif
let i += 1
endwhile
@ -121,6 +148,37 @@ func s:classes_test()
call assert_equal("\t\n\x0b\f\r ", spacechars)
call assert_equal("\t", tabchar)
call assert_equal('0123456789ABCDEFabcdef', xdigitchars)
if has('win32')
let identchars_ok = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>癒瞽瞿瞻瞼礎禮繕<E7A6AE><E7B995><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繪羅繳羶羹羸臘藩'
let kwordchars_ok = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz繕<7A><E7B995><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
elseif has('ebcdic')
let identchars_ok = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>竅簧繕繙聶<E7B999><E881B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
let kwordchars_ok = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz<79><7A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>竅簧繕繙聶<E7B999><E881B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
else
let identchars_ok = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz繕<7A><E7B995><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
let kwordchars_ok = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz繕<7A><E7B995><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
endif
if has('win32')
let fnamechars_ok = '!#$%+,-./0123456789:=@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]_abcdefghijklmnopqrstuvwxyz{}~<7E>癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶<E881B7><E881B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
elseif has('amiga')
let fnamechars_ok = '$+,-./0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~<7E>癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶<E881B7><E881B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
elseif has('vms')
let fnamechars_ok = '#$%+,-./0123456789:;<>ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz~<7E>癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶<E881B7><E881B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
elseif has('ebcdic')
let fnamechars_ok = '#$%+,-./=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~<7E>癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶<E881B7><E881B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
else
let fnamechars_ok = '#$%+,-./0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~<7E>癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶<E881B7><E881B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩'
endif
call assert_equal(identchars_ok, identchars)
call assert_equal(kwordchars_ok, kwordchars)
call assert_equal(fnamechars_ok, fnamechars)
call assert_equal(identchars1, identchars)
call assert_equal(kwordchars1, kwordchars)
call assert_equal(fnamechars1, fnamechars)
endfunc
func Test_classes_re1()
@ -351,4 +409,128 @@ func Test_regexp_ignore_case()
set regexpengine&
endfunc
" Tests for regexp with multi-byte encoding and various magic settings
func Run_regexp_multibyte_magic()
let text =<< trim END
1 a aa abb abbccc
2 d dd dee deefff
3 g gg ghh ghhiii
4 j jj jkk jkklll
5 m mm mnn mnnooo
6 x ^aa$ x
7 (a)(b) abbaa
8 axx [ab]xx
9 鉊徇腹鉆ū 鉊冢腹x
a 鉊冢腹x 鉊徇腹鉆ū
b <20><EFBFBD><EFBD9E><EFBFBD>
c x <EFBFBD>
d 憭拐蝙x
e <20><>烵y
f <20><><EFBFBD>z
g a<EFBFBD>搓b
j 0123<EFBFBD>
k combinations
l 瓣繹 羹帢<EFBFBD><EFBFBD><EFBFBD>
END
new
call setline(1, text)
exe 'normal /a*b\{2}c\+/e' .. "\<CR>x"
call assert_equal('1 a aa abb abbcc', getline('.'))
exe 'normal /\Md\*e\{2}f\+/e' .. "\<CR>x"
call assert_equal('2 d dd dee deeff', getline('.'))
set nomagic
exe 'normal /g\*h\{2}i\+/e' .. "\<CR>x"
call assert_equal('3 g gg ghh ghhii', getline('.'))
exe 'normal /\mj*k\{2}l\+/e' .. "\<CR>x"
call assert_equal('4 j jj jkk jkkll', getline('.'))
exe 'normal /\vm*n{2}o+/e' .. "\<CR>x"
call assert_equal('5 m mm mnn mnnoo', getline('.'))
exe 'normal /\V^aa$/' .. "\<CR>x"
call assert_equal('6 x aa$ x', getline('.'))
set magic
exe 'normal /\v(a)(b)\2\1\1/e' .. "\<CR>x"
call assert_equal('7 (a)(b) abba', getline('.'))
exe 'normal /\V[ab]\(\[xy]\)\1' .. "\<CR>x"
call assert_equal('8 axx ab]xx', getline('.'))
" search for multi-byte without composing char
exe 'normal /鉊<>' .. "\<CR>x"
call assert_equal('9 鉊徇腹鉆ū 鉊軍', getline('.'))
" search for multi-byte with composing char
exe 'normal /鉊﹤<E9898A>' .. "\<CR>x"
call assert_equal('a 鉊冢腹x 鉊咦', getline('.'))
" find word by change of word class
exe 'normal /<2F><<3C><EFBFBD>\><3E><>' .. "\<CR>x"
call assert_equal('b <20><EFBFBD><E68092><EFBFBD>', getline('.'))
" Test \%u, [\u] and friends
" c
exe 'normal /\%u20ac' .. "\<CR>x"
call assert_equal('c x 竅x', getline('.'))
" d
exe 'normal /[\u4f7f\u5929]\+' .. "\<CR>x"
call assert_equal('d 雿篛', getline('.'))
" e
exe 'normal /\%U12345678' .. "\<CR>x"
call assert_equal('e y', getline('.'))
" f
exe 'normal /[\U1234abcd\u1234\uabcd]' .. "\<CR>x"
call assert_equal('f z', getline('.'))
" g
exe 'normal /\%d21879b' .. "\<CR>x"
call assert_equal('g abb', getline('.'))
" j Test backwards search from a multi-byte char
exe "normal /x\<CR>x?.\<CR>x"
call assert_equal('j 012<31><32>', getline('.'))
" k
let @w=':%s#comb[i]nations#<23><>廜␌<E5BB9C><EFBFBD><EFBFBD><E5B8A2><EFBFBD>#g'
@w
call assert_equal('k <20><>廜␌<E5BB9C><EFBFBD><EFBFBD><E5B8A2><EFBFBD>', getline(18))
close!
endfunc
func Test_regexp_multibyte_magic()
set regexpengine=1
call Run_regexp_multibyte_magic()
set regexpengine=2
call Run_regexp_multibyte_magic()
set regexpengine&
endfunc
" Test for 7.3.192
" command ":s/ \?/ /g" splits multi-byte characters into bytes
func Test_split_multibyte_to_bytes()
new
call setline(1, 'l 瓣繹 羹帢<E7BEB9><E5B8A2><EFBFBD>')
s/ \?/ /g
call assert_equal(' l 瓣 繹 羹 帢<><E5B8A2><EFBFBD>', getline(1))
close!
endfunc
" Test for matchstr() with multibyte characters
func Test_matchstr_multibyte()
new
call assert_equal('<27>', matchstr("<22><><EFBFBD><EFBFBD>", ".", 0, 2))
call assert_equal('<27><>', matchstr("<22><><EFBFBD><EFBFBD>", "..", 0, 2))
call assert_equal('<27>', matchstr("<22><><EFBFBD><EFBFBD>", ".", 0, 0))
call assert_equal('<27>', matchstr("<22><><EFBFBD><EFBFBD>", ".", 4, -1))
close!
endfunc
" Test for 7.4.636
" A search with end offset gets stuck at end of file.
func Test_search_with_end_offset()
new
call setline(1, ['', 'dog(a', 'cat('])
exe "normal /(/e+" .. "\<CR>"
normal "ayn
call assert_equal("a\ncat(", @a)
close!
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@ -1,10 +1,13 @@
" Test spell checking
" Note: this file uses latin1 encoding, but is used with utf-8 encoding.
source check.vim
if !has('spell')
finish
endif
source screendump.vim
func TearDown()
set nospell
call delete('Xtest.aff')
@ -477,6 +480,44 @@ func RunGoodBad(good, bad, expected_words, expected_bad_words)
bwipe!
endfunc
func Test_spell_screendump()
CheckScreendump
let lines =<< trim END
call setline(1, [
\ "This is some text without any spell errors. Everything",
\ "should just be black, nothing wrong here.",
\ "",
\ "This line has a sepll error. and missing caps.",
\ "And and this is the the duplication.",
\ "with missing caps here.",
\ ])
set spell spelllang=en_nz
END
call writefile(lines, 'XtestSpell')
let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
call VerifyScreenDump(buf, 'Test_spell_1', {})
let lines =<< trim END
call setline(1, [
\ "This is some text without any spell errors. Everything",
\ "should just be black, nothing wrong here.",
\ "",
\ "This line has a sepll error. and missing caps.",
\ "And and this is the the duplication.",
\ "with missing caps here.",
\ ])
set spell spelllang=en_nz
END
call writefile(lines, 'XtestSpell')
let buf = RunVimInTerminal('-S XtestSpell', {'rows': 8})
call VerifyScreenDump(buf, 'Test_spell_1', {})
" clean up
call StopVimInTerminal(buf)
call delete('XtestSpell')
endfunc
let g:test_data_aff1 = [
\"SET ISO8859-1",
\"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",

View File

@ -64,3 +64,28 @@ func Test_redrawtabline()
let &showtabline = showtabline_save
au! Bufadd
endfunc
function EmptyTabname()
return ""
endfunction
function MakeTabLine() abort
let titles = map(range(1, tabpagenr('$')), '"%( %" . v:val . "T%{EmptyTabname()}%T %)"')
let sep = 'あ'
let tabpages = join(titles, sep)
return tabpages .. sep .. '%=%999X X'
endfunction
func Test_tabline_empty_group()
" this was reading invalid memory
set tabline=%!MakeTabLine()
tabnew
redraw!
tabclose
set tabline=
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@ -7,6 +7,9 @@ local iswin = helpers.iswin
local retry = helpers.retry
local ok = helpers.ok
local source = helpers.source
local wait = helpers.wait
local uname = helpers.uname
local load_adjust = helpers.load_adjust
local monitor_memory_usage = {
memory_usage = function(self)
@ -99,6 +102,7 @@ describe('memory usage', function()
call s:f(0)
endfor
]])
wait()
local after = monitor_memory_usage(pid)
-- Estimate the limit of max usage as 2x initial usage.
-- The lower limit can fluctuate a bit, use 97%.
@ -143,16 +147,20 @@ describe('memory usage', function()
call s:f()
endfor
]])
wait()
local after = monitor_memory_usage(pid)
for _ = 1, 3 do
feed_command('so '..fname)
wait()
end
local last = monitor_memory_usage(pid)
-- The usage may be a bit less than the last value, use 80%.
-- Allow for 20% tolerance at the upper limit. That's very permissive, but
-- otherwise the test fails sometimes.
-- otherwise the test fails sometimes. On Sourcehut CI with FreeBSD we need to
-- be even more permissive.
local upper_multiplier = uname() == 'freebsd' and 15 or 12
local lower = before.last * 8 / 10
local upper = (after.max + (after.last - before.last)) * 12 / 10
local upper = load_adjust((after.max + (after.last - before.last)) * upper_multiplier / 10)
check_result({before=before, after=after, last=last},
pcall(ok, lower < last.last))
check_result({before=before, after=after, last=last},

View File

@ -605,6 +605,8 @@ describe('TUI', function()
wait_for_mode('i')
-- "bracketed paste"
feed_data('\027[200~'..expected..'\027[201~')
-- FIXME: Data race between the two feeds
if uname() == 'freebsd' then screen:sleep(1) end
feed_data(' end')
expected = expected..' end'
screen:expect([[

View File

@ -6,6 +6,7 @@ local clear = helpers.clear
local command = helpers.command
local insert = helpers.insert
local write_file = helpers.write_file
local source = helpers.source
describe('Diff mode screen', function()
local fname = 'Xtest-functional-diff-screen-1'
@ -1031,3 +1032,79 @@ it('win_update redraws lines properly', function()
|
]]}
end)
it('diff updates line numbers below filler lines', function()
clear()
local screen = Screen.new(40, 14)
screen:attach()
screen:set_default_attr_ids({
[1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
[2] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
[3] = {reverse = true},
[4] = {background = Screen.colors.LightBlue},
[5] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey},
[6] = {bold = true, foreground = Screen.colors.Blue1},
[7] = {bold = true, reverse = true},
[8] = {bold = true, background = Screen.colors.Red},
[9] = {background = Screen.colors.LightMagenta},
[10] = {bold = true, foreground = Screen.colors.Brown},
[11] = {foreground = Screen.colors.Brown},
})
source([[
call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
vnew
call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
windo diffthis
setlocal number rnu foldcolumn=0
]])
screen:expect([[
{1: }a {3:}{10:1 }^a |
{1: }a {3:}{11: 1 }a |
{1: }a {3:}{11: 2 }a |
{1: }{8:x}{9: }{3:}{11: 3 }{8:y}{9: }|
{1: }{4:x }{3:}{11: }{2:----------------}|
{1: }{4:x }{3:}{11: }{2:----------------}|
{1: }b {3:}{11: 4 }b |
{1: }b {3:}{11: 5 }b |
{1: }b {3:}{11: 6 }b |
{1: }b {3:}{11: 7 }b |
{1: }b {3:}{11: 8 }b |
{6:~ }{3:}{6:~ }|
{3:[No Name] [+] }{7:[No Name] [+] }|
|
]])
feed('j')
screen:expect([[
{1: }a {3:}{11: 1 }a |
{1: }a {3:}{10:2 }^a |
{1: }a {3:}{11: 1 }a |
{1: }{8:x}{9: }{3:}{11: 2 }{8:y}{9: }|
{1: }{4:x }{3:}{11: }{2:----------------}|
{1: }{4:x }{3:}{11: }{2:----------------}|
{1: }b {3:}{11: 3 }b |
{1: }b {3:}{11: 4 }b |
{1: }b {3:}{11: 5 }b |
{1: }b {3:}{11: 6 }b |
{1: }b {3:}{11: 7 }b |
{6:~ }{3:}{6:~ }|
{3:[No Name] [+] }{7:[No Name] [+] }|
|
]])
feed('j')
screen:expect([[
{1: }a {3:}{11: 2 }a |
{1: }a {3:}{11: 1 }a |
{1: }a {3:}{10:3 }^a |
{1: }{8:x}{9: }{3:}{11: 1 }{8:y}{9: }|
{1: }{4:x }{3:}{11: }{2:----------------}|
{1: }{4:x }{3:}{11: }{2:----------------}|
{1: }b {3:}{11: 2 }b |
{1: }b {3:}{11: 3 }b |
{1: }b {3:}{11: 4 }b |
{1: }b {3:}{11: 5 }b |
{1: }b {3:}{11: 6 }b |
{6:~ }{3:}{6:~ }|
{3:[No Name] [+] }{7:[No Name] [+] }|
|
]])
end)

View File

@ -4,8 +4,9 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local feed = helpers.feed
local feed_command = helpers.feed_command
local insert = helpers.insert
local uname = helpers.uname
local command = helpers.command
describe("'spell'", function()
local screen
@ -16,12 +17,14 @@ describe("'spell'", function()
screen:attach()
screen:set_default_attr_ids( {
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {special = Screen.colors.Red, undercurl = true}
[1] = {special = Screen.colors.Red, undercurl = true},
[2] = {special = Screen.colors.Blue1, undercurl = true},
})
end)
it('joins long lines #7937', function()
feed_command('set spell')
if uname() == 'openbsd' then pending('FIXME #12104', function() end) return end
command('set spell')
insert([[
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
@ -42,4 +45,26 @@ describe("'spell'", function()
|
]])
end)
it('has correct highlight at start of line', function()
insert([[
"This is some text without any spell errors. Everything",
"should just be black, nothing wrong here.",
"",
"This line has a sepll error. and missing caps.",
"And and this is the the duplication.",
"with missing caps here.",
]])
command('set spell spelllang=en_nz')
screen:expect([[
"This is some text without any spell errors. Everything", |
"should just be black, nothing wrong here.", |
"", |
"This line has a {1:sepll} error. {2:and} missing caps.", |
"{1:And and} this is {1:the the} duplication.", |
"with missing caps here.", |
^ |
|
]])
end)
end)