aboutsummaryrefslogtreecommitdiff
path: root/src/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim')
-rw-r--r--src/nvim/eval.c37
-rw-r--r--src/nvim/ex_getln.c3
-rw-r--r--src/nvim/ex_getln.h19
-rw-r--r--src/nvim/file_search.c9
-rw-r--r--src/nvim/message.c3
-rw-r--r--src/nvim/path.h1
-rw-r--r--src/nvim/quickfix.c24
-rw-r--r--src/nvim/regexp.c2
-rw-r--r--src/nvim/screen.c3
-rw-r--r--src/nvim/version.c12
-rw-r--r--src/nvim/window.c22
-rw-r--r--src/nvim/window.h1
12 files changed, 83 insertions, 53 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index a5a8671697..219bd38d82 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -4638,10 +4638,13 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
int n, nr;
int c = toupper(*p);
- if (c == 'X')
+ if (c == 'X') {
n = 2;
- else
+ } else if (*p == 'u') {
n = 4;
+ } else {
+ n = 8;
+ }
nr = 0;
while (--n >= 0 && ascii_isxdigit(p[1])) {
++p;
@@ -7188,9 +7191,9 @@ static struct fst {
{ "getwinposx", 0, 0, f_getwinposx },
{ "getwinposy", 0, 0, f_getwinposy },
{ "getwinvar", 2, 3, f_getwinvar },
- { "glob", 1, 3, f_glob },
+ { "glob", 1, 4, f_glob },
{ "glob2regpat", 1, 1, f_glob2regpat },
- { "globpath", 2, 4, f_globpath },
+ { "globpath", 2, 5, f_globpath },
{ "has", 1, 1, f_has },
{ "has_key", 2, 2, f_has_key },
{ "haslocaldir", 0, 0, f_haslocaldir },
@@ -10701,10 +10704,15 @@ static void f_glob(typval_T *argvars, typval_T *rettv)
if (argvars[1].v_type != VAR_UNKNOWN) {
if (get_tv_number_chk(&argvars[1], &error))
options |= WILD_KEEP_ALL;
- if (argvars[2].v_type != VAR_UNKNOWN
- && get_tv_number_chk(&argvars[2], &error)) {
- rettv->v_type = VAR_LIST;
- rettv->vval.v_list = NULL;
+ if (argvars[2].v_type != VAR_UNKNOWN) {
+ if (get_tv_number_chk(&argvars[2], &error)) {
+ rettv->v_type = VAR_LIST;
+ rettv->vval.v_list = NULL;
+ }
+ if (argvars[3].v_type != VAR_UNKNOWN
+ && get_tv_number_chk(&argvars[3], &error)) {
+ options |= WILD_ALLLINKS;
+ }
}
}
if (!error) {
@@ -10743,10 +10751,15 @@ static void f_globpath(typval_T *argvars, typval_T *rettv)
flags |= WILD_KEEP_ALL;
}
- if (argvars[3].v_type != VAR_UNKNOWN
- && get_tv_number_chk(&argvars[3], &error)) {
- rettv->v_type = VAR_LIST;
- rettv->vval.v_list = NULL;
+ if (argvars[3].v_type != VAR_UNKNOWN) {
+ if (get_tv_number_chk(&argvars[3], &error)) {
+ rettv->v_type = VAR_LIST;
+ rettv->vval.v_list = NULL;
+ }
+ if (argvars[4].v_type != VAR_UNKNOWN
+ && get_tv_number_chk(&argvars[4], &error)) {
+ flags |= WILD_ALLLINKS;
+ }
}
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 87a6bf8901..b19331ad06 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -3701,6 +3701,9 @@ ExpandFromContext (
flags |= EW_KEEPALL;
if (options & WILD_SILENT)
flags |= EW_SILENT;
+ if (options & WILD_ALLLINKS) {
+ flags |= EW_ALLLINKS;
+ }
if (xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_DIRECTORIES
diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h
index c537d681c6..21da8b9d42 100644
--- a/src/nvim/ex_getln.h
+++ b/src/nvim/ex_getln.h
@@ -14,15 +14,16 @@
#define WILD_LONGEST 7
#define WILD_ALL_KEEP 8
-#define WILD_LIST_NOTFOUND 1
-#define WILD_HOME_REPLACE 2
-#define WILD_USE_NL 4
-#define WILD_NO_BEEP 8
-#define WILD_ADD_SLASH 16
-#define WILD_KEEP_ALL 32
-#define WILD_SILENT 64
-#define WILD_ESCAPE 128
-#define WILD_ICASE 256
+#define WILD_LIST_NOTFOUND 0x01
+#define WILD_HOME_REPLACE 0x02
+#define WILD_USE_NL 0x04
+#define WILD_NO_BEEP 0x08
+#define WILD_ADD_SLASH 0x10
+#define WILD_KEEP_ALL 0x20
+#define WILD_SILENT 0x40
+#define WILD_ESCAPE 0x80
+#define WILD_ICASE 0x100
+#define WILD_ALLLINKS 0x200
/// Present history tables
typedef enum {
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index 4f345158cf..b213a42c52 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -1340,6 +1340,7 @@ void free_findfile(void)
*
* options:
* FNAME_MESS give error message when not found
+ * FNAME_UNESC unescape backslashes
*
* Uses NameBuff[]!
*
@@ -1385,6 +1386,14 @@ find_file_in_path_option (
xfree(ff_file_to_find);
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] == '.'
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 00f4c0a85c..1dd71baaa4 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1396,7 +1396,8 @@ void msg_prt_line(char_u *s, int list)
c = *p_extra++;
} else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1) {
col += (*mb_ptr2cells)(s);
- if (lcs_nbsp != NUL && list && mb_ptr2char(s) == 160) {
+ if (lcs_nbsp != NUL && list
+ && (mb_ptr2char(s) == 160 || mb_ptr2char(s) == 0x202f)) {
mb_char2bytes(lcs_nbsp, buf);
buf[(*mb_ptr2len)(buf)] = NUL;
} else {
diff --git a/src/nvim/path.h b/src/nvim/path.h
index 628ea335ed..eac367d0ac 100644
--- a/src/nvim/path.h
+++ b/src/nvim/path.h
@@ -20,6 +20,7 @@
#define EW_KEEPDOLLAR 0x800 /* do not escape $, $var is expanded */
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
* is used when executing commands and EW_SILENT for interactive expanding. */
+#define EW_ALLLINKS 0x1000 // also links not pointing to existing file
/// Return value for the comparison of two files. Also @see path_full_compare.
typedef enum file_comparison {
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 3abf43cb8c..85c69af192 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -2117,14 +2117,10 @@ void ex_copen(exarg_T *eap)
prevwin = win;
}
- /*
- * Fill the buffer with the quickfix list.
- */
- qf_fill_buffer(qi);
+ qf_set_title_var(qi);
- if (qi->qf_lists[qi->qf_curlist].qf_title != NULL) {
- qf_set_title_var(qi);
- }
+ // Fill the buffer with the quickfix list.
+ qf_fill_buffer(qi);
curwin->w_cursor.lnum = qi->qf_lists[qi->qf_curlist].qf_index;
curwin->w_cursor.col = 0;
@@ -2256,16 +2252,13 @@ static void qf_update_buffer(qf_info_T *qi)
/* set curwin/curbuf to buf and save a few things */
aucmd_prepbuf(&aco, buf);
- qf_fill_buffer(qi);
-
- if (qi->qf_lists[qi->qf_curlist].qf_title != NULL
- && (win = qf_find_win(qi)) != NULL) {
+ if ((win = qf_find_win(qi)) != NULL) {
curwin_save = curwin;
curwin = win;
qf_set_title_var(qi);
curwin = curwin_save;
-
}
+ qf_fill_buffer(qi);
/* restore curwin/curbuf and a few other things */
aucmd_restbuf(&aco);
@@ -2274,10 +2267,13 @@ static void qf_update_buffer(qf_info_T *qi)
}
}
+// Set "w:quickfix_title" if "qi" has a title.
static void qf_set_title_var(qf_info_T *qi)
{
- set_internal_string_var((char_u *)"w:quickfix_title",
- qi->qf_lists[qi->qf_curlist].qf_title);
+ if (qi->qf_lists[qi->qf_curlist].qf_title != NULL) {
+ set_internal_string_var((char_u *)"w:quickfix_title",
+ qi->qf_lists[qi->qf_curlist].qf_title);
+ }
}
/*
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 39001939d8..e01e812a70 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -4186,7 +4186,7 @@ regmatch (
/* When only a composing char is given match at any
* position where that composing char appears. */
status = RA_NOMATCH;
- for (i = 0; reginput[i] != NUL; i += utf_char2len(inpc)) {
+ for (i = 0; reginput[i] != NUL; i += utf_ptr2len(reginput + i)) {
inpc = mb_ptr2char(reginput + i);
if (!utf_iscomposing(inpc)) {
if (i > 0)
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 9a64a7c3a9..c6d1ea790e 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3202,7 +3202,8 @@ win_line (
// 'list': change char 160 to lcs_nbsp and space to lcs_space.
if (wp->w_p_list
- && (((c == 160 || (mb_utf8 && mb_c == 160)) && lcs_nbsp)
+ && (((c == 160 || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
+ && lcs_nbsp)
|| (c == ' ' && lcs_space && ptr - line <= trailcol))) {
c = (c == ' ') ? lcs_space : lcs_nbsp;
if (area_attr == 0 && search_attr == 0) {
diff --git a/src/nvim/version.c b/src/nvim/version.c
index cbc3ec6978..dcd1773a7a 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -385,7 +385,7 @@ static int included_patches[] = {
// 742,
// 741,
// 740,
- // 739,
+ 739,
// 738 NA
// 737,
736,
@@ -402,11 +402,11 @@ static int included_patches[] = {
// 725,
// 724 NA
723,
- // 722,
+ 722,
721,
// 720 NA
719,
- // 718,
+ 718,
// 717,
716,
715,
@@ -439,7 +439,7 @@ static int included_patches[] = {
// 688,
// 687 NA
686,
- // 685,
+ 685,
// 684,
// 683 NA
682,
@@ -470,7 +470,7 @@ static int included_patches[] = {
// 657 NA
// 656,
655,
- // 654,
+ 654,
653,
// 652 NA
651,
@@ -482,7 +482,7 @@ static int included_patches[] = {
645,
// 644 NA
// 643,
- // 642,
+ 642,
// 641 NA
640,
// 639,
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 16ff7dfb14..f0c6cacdf0 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -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)
{
+ int options = FNAME_MESS | FNAME_EXP | FNAME_REL | FNAME_UNESC;
if (VIsual_active) {
size_t len;
char_u *ptr;
if (get_visual_text(NULL, &ptr, &len) == FAIL)
return NULL;
- return find_file_name_in_path(ptr, len,
- FNAME_MESS|FNAME_EXP|FNAME_REL,
- count, curbuf->b_ffname);
+ return find_file_name_in_path(ptr, len, options, count, curbuf->b_ffname);
}
- return file_name_at_cursor(FNAME_MESS|FNAME_HYP|FNAME_EXP|FNAME_REL, count,
- file_lnum);
+ return file_name_at_cursor(options | FNAME_HYP, count, file_lnum);
}
/*
@@ -4918,12 +4916,18 @@ file_name_in_line (
* Also allow "://" when ':' is not in 'isfname'.
*/
len = 0;
- while (vim_isfilec(ptr[len])
- || ((options & FNAME_HYP) && path_is_url((char *)ptr + len)))
- if (has_mbyte)
+ while (vim_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ')
+ || ((options & FNAME_HYP) && path_is_url((char *)ptr + len))) {
+ if (ptr[len] == '\\' && ptr[len + 1] == ' ') {
+ // Skip over the "\" in "\ ".
+ ++len;
+ }
+ if (has_mbyte) {
len += (size_t)(*mb_ptr2len)(ptr + len);
- else
+ } else {
++len;
+ }
+ }
/*
* If there is trailing punctuation, remove it.
diff --git a/src/nvim/window.h b/src/nvim/window.h
index eccc7835a8..2ac4c00c28 100644
--- a/src/nvim/window.h
+++ b/src/nvim/window.h
@@ -10,6 +10,7 @@
#define FNAME_INCL 8 /* apply 'includeexpr' */
#define FNAME_REL 16 /* ".." and "./" are relative to the (current)
file instead of the current directory */
+#define FNAME_UNESC 32 // remove backslashes used for escaping
/*
* arguments for win_split()