diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-06 20:39:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-06 20:39:53 -0500 |
commit | 7477703586af3710584888b197d84a0938a27fe9 (patch) | |
tree | a2b17e49945fcdb5879e79a5d46bd27e326659ca /src | |
parent | 5855a3ea7bf19fdf8d1c0351ce062386fb98127a (diff) | |
parent | 8ae34ab7802763c2bbf64c8ba99c36d159da7220 (diff) | |
download | rneovim-7477703586af3710584888b197d84a0938a27fe9.tar.gz rneovim-7477703586af3710584888b197d84a0938a27fe9.tar.bz2 rneovim-7477703586af3710584888b197d84a0938a27fe9.zip |
Merge pull request #13468 from janlazo/vim-8.1.0818
vim-patch:8.1.{818,1131,2064},8.2.{587,879,1021,1296,2104}
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_getln.c | 3 | ||||
-rw-r--r-- | src/nvim/log.c | 9 | ||||
-rw-r--r-- | src/nvim/testdir/test_ruby.vim | 24 | ||||
-rw-r--r-- | src/nvim/testdir/test_search.vim | 23 | ||||
-rw-r--r-- | src/nvim/undo.c | 5 |
5 files changed, 53 insertions, 11 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index ed408c28e5..a0910f1394 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4327,7 +4327,8 @@ void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int o /// if true then it escapes for a shell command. /// /// @return [allocated] escaped file name. -char *vim_strsave_fnameescape(const char *const fname, const bool shell) +char *vim_strsave_fnameescape(const char *const fname, + const bool shell FUNC_ATTR_UNUSED) FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { #ifdef BACKSLASH_IN_FILENAME diff --git a/src/nvim/log.c b/src/nvim/log.c index 225e40cdb4..19203a3c2a 100644 --- a/src/nvim/log.c +++ b/src/nvim/log.c @@ -13,9 +13,6 @@ #include <stdarg.h> #include <stdbool.h> #include <stdio.h> -#if !defined(WIN32) -# include <sys/time.h> // for gettimeofday() -#endif #include <uv.h> #include "auto/config.h" @@ -296,12 +293,10 @@ static bool v_do_log_to_file(FILE *log_file, int log_level, } int millis = 0; -#if !defined(WIN32) - struct timeval curtime; - if (gettimeofday(&curtime, NULL) == 0) { + uv_timeval64_t curtime; + if (uv_gettimeofday(&curtime) == 0) { millis = (int)curtime.tv_usec / 1000; } -#endif // Print the log message. int64_t pid = os_get_pid(); diff --git a/src/nvim/testdir/test_ruby.vim b/src/nvim/testdir/test_ruby.vim index 9c74c35049..1a274d1fec 100644 --- a/src/nvim/testdir/test_ruby.vim +++ b/src/nvim/testdir/test_ruby.vim @@ -27,6 +27,19 @@ func Test_rubydo() %bwipe! endfunc +func Test_rubydo_dollar_underscore() + throw 'skipped: TODO: ' + new + call setline(1, ['one', 'two', 'three', 'four']) + 2,3rubydo $_ = '[' + $_ + ']' + call assert_equal(['one', '[two]', '[three]', 'four'], getline(1, '$')) + bwipe! + + call assert_fails('rubydo $_ = 0', 'E265:') + call assert_fails('rubydo (') + bwipe! +endfunc + func Test_rubyfile() " Check :rubyfile does not SEGV with Ruby level exception but just fails let tempfile = tempname() . '.rb' @@ -391,3 +404,14 @@ func Test_ruby_p() let messages = GetMessages() call assert_equal(0, len(messages)) endfunc + +func Test_rubyeval_error() + " On Linux or Windows the error matches: + " "syntax error, unexpected end-of-input" + " whereas on macOS in CI, the error message makes less sense: + " "SyntaxError: array length must be 2" + " Unclear why. The test does not check the error message. + call assert_fails('call rubyeval("(")') +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 6824c50112..8d71ada551 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -508,7 +508,7 @@ endfunc func Test_search_cmdline7() throw 'skipped: Nvim does not support test_override()' - " Test that an pressing <c-g> in an empty command line + " Test that pressing <c-g> in an empty command line " does not move the cursor if !exists('+incsearch') return @@ -1172,3 +1172,24 @@ func Test_search_special() set t_PE= exe "norm /\x80PS" endfunc + +" Test 'smartcase' with utf-8. +func Test_search_smartcase_utf8() + new + let save_enc = &encoding + set encoding=utf8 ignorecase smartcase + + call setline(1, 'Café cafÉ') + 1s/café/x/g + call assert_equal('x x', getline(1)) + + call setline(1, 'Café cafÉ') + 1s/cafÉ/x/g + call assert_equal('Café x', getline(1)) + + set ignorecase& smartcase& + let &encoding = save_enc + close! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/undo.c b/src/nvim/undo.c index a8b8f7aa50..636d00bbbf 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -1255,7 +1255,8 @@ theend: /// a bit more verbose. /// Otherwise use curbuf->b_ffname to generate the undo file name. /// "hash[UNDO_HASH_SIZE]" must be the hash value of the buffer text. -void u_read_undo(char *name, char_u *hash, char_u *orig_name) +void u_read_undo(char *name, const char_u *hash, + const char_u *orig_name FUNC_ATTR_UNUSED) FUNC_ATTR_NONNULL_ARG(2) { u_header_T **uhp_table = NULL; @@ -1273,7 +1274,7 @@ void u_read_undo(char *name, char_u *hash, char_u *orig_name) // owner of the text file or equal to the current user. FileInfo file_info_orig; FileInfo file_info_undo; - if (os_fileinfo((char *)orig_name, &file_info_orig) + if (os_fileinfo((const char *)orig_name, &file_info_orig) && os_fileinfo((char *)file_name, &file_info_undo) && file_info_orig.stat.st_uid != file_info_undo.stat.st_uid && file_info_undo.stat.st_uid != getuid()) { |