aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.clang-format8
-rw-r--r--src/nvim/os/stdpaths.c3
-rw-r--r--src/nvim/syntax.c26
-rw-r--r--src/nvim/tempfile.c3
-rw-r--r--src/nvim/version.c4
5 files changed, 28 insertions, 16 deletions
diff --git a/src/.clang-format b/src/.clang-format
index 35e545ac4b..5a910ff34b 100644
--- a/src/.clang-format
+++ b/src/.clang-format
@@ -1,4 +1,4 @@
-BasedOnStyle: llvm
+BasedOnStyle: Google
Language: Cpp
ColumnLimit: 80
IndentWidth: 2
@@ -10,3 +10,9 @@ AlignEscapedNewlinesLeft: false
AllowShortFunctionsOnASingleLine: false
SpacesBeforeTrailingComments: 2
PenaltyReturnTypeOnItsOwnLine: 200
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+BinPackParameters: false
+BreakBeforeBinaryOperators: true
+ContinuationIndentWidth: 4
diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c
index 8a8f43cb8a..81ceb919c4 100644
--- a/src/nvim/os/stdpaths.c
+++ b/src/nvim/os/stdpaths.c
@@ -75,7 +75,8 @@ static char *get_xdg_home(const XDGVarType idx)
char *dir = stdpaths_get_xdg_var(idx);
if (dir) {
#if defined(WIN32)
- dir = concat_fnames_realloc(dir, (idx == kXDGDataHome ? "nvim-data" : "nvim"),
+ dir = concat_fnames_realloc(dir,
+ (idx == kXDGDataHome ? "nvim-data" : "nvim"),
true);
#else
dir = concat_fnames_realloc(dir, "nvim", true);
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 478fa973a1..04e28cf5ca 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5533,25 +5533,29 @@ char_u *get_syntax_name(expand_T *xp, int idx)
}
-/*
- * Function called for expression evaluation: get syntax ID at file position.
- */
-int
-syn_get_id (
+// Function called for expression evaluation: get syntax ID at file position.
+int syn_get_id(
win_T *wp,
long lnum,
colnr_T col,
- int trans, /* remove transparency */
- bool *spellp, /* return: can do spell checking */
- int keep_state /* keep state of char at "col" */
+ int trans, // remove transparency
+ bool *spellp, // return: can do spell checking
+ int keep_state // keep state of char at "col"
)
{
- /* When the position is not after the current position and in the same
- * line of the same buffer, need to restart parsing. */
+ // When the position is not after the current position and in the same
+ // line of the same buffer, need to restart parsing.
if (wp->w_buffer != syn_buf
|| lnum != current_lnum
- || col < current_col)
+ || col < current_col) {
syntax_start(wp, lnum);
+ } else if (wp->w_buffer == syn_buf
+ && lnum == current_lnum
+ && col > current_col) {
+ // next_match may not be correct when moving around, e.g. with the
+ // "skip" expression in searchpair()
+ next_match_idx = -1;
+ }
(void)get_syntax_attr(col, spellp, keep_state);
diff --git a/src/nvim/tempfile.c b/src/nvim/tempfile.c
index a218c03fdb..afe926b2ef 100644
--- a/src/nvim/tempfile.c
+++ b/src/nvim/tempfile.c
@@ -32,8 +32,9 @@ static void vim_maketempdir(void)
char_u path[TEMP_FILE_PATH_MAXLEN];
for (size_t i = 0; i < ARRAY_SIZE(temp_dirs); ++i) {
// Expand environment variables, leave room for "/nvimXXXXXX/999999999"
+ // Skip the directory check if the expansion fails.
expand_env((char_u *)temp_dirs[i], template, TEMP_FILE_PATH_MAXLEN - 22);
- if (!os_isdir(template)) { // directory doesn't exist
+ if (template[0] == '$' || !os_isdir(template)) {
continue;
}
diff --git a/src/nvim/version.c b/src/nvim/version.c
index bc10187aa3..4e875516c0 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -149,7 +149,7 @@ static int included_patches[] = {
// 1144 NA
// 1143,
// 1142,
- // 1141,
+ 1141,
// 1140,
// 1139 NA
// 1138 NA
@@ -332,7 +332,7 @@ static int included_patches[] = {
961,
// 960 NA
// 959 NA
- // 958,
+ 958,
// 957,
// 956 NA
955,