aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/charset.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/charset.c')
-rw-r--r--src/nvim/charset.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 3d4e0abda9..8cae831881 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -858,8 +858,10 @@ bool vim_iswordp_buf(const char *const p, buf_T *const buf)
return vim_iswordc_buf(c, buf);
}
-/// Check that "c" is a valid file-name character.
+/// Check that "c" is a valid file-name character as specified with the
+/// 'isfname' option.
/// Assume characters above 0x100 are valid (multi-byte).
+/// To be used for commands like "gf".
///
/// @param c character to check
bool vim_isfilec(int c)
@@ -868,6 +870,14 @@ bool vim_isfilec(int c)
return c >= 0x100 || (c > 0 && (g_chartab[c] & CT_FNAME_CHAR));
}
+/// Check if "c" is a valid file-name character, including characters left
+/// out of 'isfname' to make "gf" work, such as comma, space, '@', etc.
+bool vim_is_fname_char(int c)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+{
+ return vim_isfilec(c) || c == ',' || c == ' ' || c == '@';
+}
+
/// Check that "c" is a valid file-name character or a wildcard character
/// Assume characters above 0x100 are valid (multi-byte).
/// Explicitly interpret ']' as a wildcard character as path_has_wildcard("]")