mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
Merge pull request #13468 from janlazo/vim-8.1.0818
vim-patch:8.1.{818,1131,2064},8.2.{587,879,1021,1296,2104}
This commit is contained in:
commit
7477703586
@ -8441,8 +8441,6 @@ strftime({format} [, {time}]) *strftime()*
|
||||
:echo strftime("%H:%M") 11:55
|
||||
:echo strftime("%c", getftime("file.c"))
|
||||
Show mod time of file.c.
|
||||
< Not available on all systems. To check use: >
|
||||
:if exists("*strftime")
|
||||
|
||||
strgetchar({str}, {index}) *strgetchar()*
|
||||
Get character {index} from {str}. This uses a character
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user