mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
commit
4172ce4eb0
@ -1340,6 +1340,7 @@ void free_findfile(void)
|
|||||||
*
|
*
|
||||||
* options:
|
* options:
|
||||||
* FNAME_MESS give error message when not found
|
* FNAME_MESS give error message when not found
|
||||||
|
* FNAME_UNESC unescape backslashes
|
||||||
*
|
*
|
||||||
* Uses NameBuff[]!
|
* Uses NameBuff[]!
|
||||||
*
|
*
|
||||||
@ -1385,6 +1386,14 @@ find_file_in_path_option (
|
|||||||
|
|
||||||
xfree(ff_file_to_find);
|
xfree(ff_file_to_find);
|
||||||
ff_file_to_find = vim_strsave(NameBuff);
|
ff_file_to_find = vim_strsave(NameBuff);
|
||||||
|
if (options & FNAME_UNESC) {
|
||||||
|
// Change all "\ " to " ".
|
||||||
|
for (ptr = ff_file_to_find; *ptr != NUL; ++ptr) {
|
||||||
|
if (ptr[0] == '\\' && ptr[1] == ' ') {
|
||||||
|
memmove(ptr, ptr + 1, STRLEN(ptr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rel_to_curdir = (ff_file_to_find[0] == '.'
|
rel_to_curdir = (ff_file_to_find[0] == '.'
|
||||||
|
@ -482,7 +482,7 @@ static int included_patches[] = {
|
|||||||
645,
|
645,
|
||||||
// 644 NA
|
// 644 NA
|
||||||
// 643,
|
// 643,
|
||||||
// 642,
|
642,
|
||||||
// 641 NA
|
// 641 NA
|
||||||
640,
|
640,
|
||||||
// 639,
|
// 639,
|
||||||
|
@ -4837,17 +4837,15 @@ static void frame_add_height(frame_T *frp, int n)
|
|||||||
*/
|
*/
|
||||||
char_u *grab_file_name(long count, linenr_T *file_lnum)
|
char_u *grab_file_name(long count, linenr_T *file_lnum)
|
||||||
{
|
{
|
||||||
|
int options = FNAME_MESS | FNAME_EXP | FNAME_REL | FNAME_UNESC;
|
||||||
if (VIsual_active) {
|
if (VIsual_active) {
|
||||||
size_t len;
|
size_t len;
|
||||||
char_u *ptr;
|
char_u *ptr;
|
||||||
if (get_visual_text(NULL, &ptr, &len) == FAIL)
|
if (get_visual_text(NULL, &ptr, &len) == FAIL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return find_file_name_in_path(ptr, len,
|
return find_file_name_in_path(ptr, len, options, count, curbuf->b_ffname);
|
||||||
FNAME_MESS|FNAME_EXP|FNAME_REL,
|
|
||||||
count, curbuf->b_ffname);
|
|
||||||
}
|
}
|
||||||
return file_name_at_cursor(FNAME_MESS|FNAME_HYP|FNAME_EXP|FNAME_REL, count,
|
return file_name_at_cursor(options | FNAME_HYP, count, file_lnum);
|
||||||
file_lnum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4918,12 +4916,18 @@ file_name_in_line (
|
|||||||
* Also allow "://" when ':' is not in 'isfname'.
|
* Also allow "://" when ':' is not in 'isfname'.
|
||||||
*/
|
*/
|
||||||
len = 0;
|
len = 0;
|
||||||
while (vim_isfilec(ptr[len])
|
while (vim_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ')
|
||||||
|| ((options & FNAME_HYP) && path_is_url((char *)ptr + len)))
|
|| ((options & FNAME_HYP) && path_is_url((char *)ptr + len))) {
|
||||||
if (has_mbyte)
|
if (ptr[len] == '\\' && ptr[len + 1] == ' ') {
|
||||||
len += (size_t)(*mb_ptr2len)(ptr + len);
|
// Skip over the "\" in "\ ".
|
||||||
else
|
|
||||||
++len;
|
++len;
|
||||||
|
}
|
||||||
|
if (has_mbyte) {
|
||||||
|
len += (size_t)(*mb_ptr2len)(ptr + len);
|
||||||
|
} else {
|
||||||
|
++len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there is trailing punctuation, remove it.
|
* If there is trailing punctuation, remove it.
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#define FNAME_INCL 8 /* apply 'includeexpr' */
|
#define FNAME_INCL 8 /* apply 'includeexpr' */
|
||||||
#define FNAME_REL 16 /* ".." and "./" are relative to the (current)
|
#define FNAME_REL 16 /* ".." and "./" are relative to the (current)
|
||||||
file instead of the current directory */
|
file instead of the current directory */
|
||||||
|
#define FNAME_UNESC 32 // remove backslashes used for escaping
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* arguments for win_split()
|
* arguments for win_split()
|
||||||
|
Loading…
Reference in New Issue
Block a user