aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/commitlint.config.js35
-rw-r--r--.github/workflows/commitlint.config_patch.js27
-rw-r--r--.github/workflows/commitlint.yml18
-rw-r--r--CONTRIBUTING.md36
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/mbyte.c3
-rw-r--r--src/nvim/option.c2
-rw-r--r--src/nvim/tag.c29
-rw-r--r--src/nvim/testdir/test_functions.vim3
-rw-r--r--src/nvim/testdir/test_spellfile.vim46
11 files changed, 175 insertions, 28 deletions
diff --git a/.github/workflows/commitlint.config.js b/.github/workflows/commitlint.config.js
new file mode 100644
index 0000000000..5f10ffc6f4
--- /dev/null
+++ b/.github/workflows/commitlint.config.js
@@ -0,0 +1,35 @@
+module.exports = {
+ rules: {
+ 'body-leading-blank': [1, 'always'],
+ 'body-max-line-length': [2, 'always', 100],
+ 'footer-leading-blank': [1, 'always'],
+ 'footer-max-line-length': [2, 'always', 100],
+ 'header-max-length': [2, 'always', 100],
+ 'scope-case': [2, 'always', 'lower-case'],
+ 'subject-case': [
+ 2,
+ 'never',
+ ['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
+ ],
+ 'subject-empty': [2, 'never'],
+ 'subject-full-stop': [2, 'never', '.'],
+ 'type-case': [2, 'always', 'lower-case'],
+ 'type-empty': [2, 'never'],
+ 'type-enum': [
+ 2,
+ 'always',
+ [
+ 'build',
+ 'chore',
+ 'ci',
+ 'docs',
+ 'feat',
+ 'fix',
+ 'perf',
+ 'refactor',
+ 'revert',
+ 'test',
+ ],
+ ],
+ },
+};
diff --git a/.github/workflows/commitlint.config_patch.js b/.github/workflows/commitlint.config_patch.js
new file mode 100644
index 0000000000..ca398c45dc
--- /dev/null
+++ b/.github/workflows/commitlint.config_patch.js
@@ -0,0 +1,27 @@
+module.exports = {
+ parserPreset: {
+ parserOpts: { headerPattern: /^([^\(\):]*)(?:\((.*)\))?!?:(.*)$/ }
+ },
+ rules: {
+ 'body-leading-blank': [1, 'always'],
+ 'body-max-line-length': [2, 'always', 100],
+ 'footer-max-line-length': [2, 'always', 100],
+ 'scope-case': [2, 'always', 'lower-case'],
+ 'subject-case': [
+ 2,
+ 'never',
+ ['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
+ ],
+ 'subject-empty': [2, 'never'],
+ 'subject-full-stop': [2, 'never', '.'],
+ 'type-case': [2, 'always', 'lower-case'],
+ 'type-empty': [2, 'never'],
+ 'type-enum': [
+ 2,
+ 'always',
+ [
+ 'vim-patch',
+ ],
+ ],
+ },
+};
diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml
new file mode 100644
index 0000000000..9ae138fbd7
--- /dev/null
+++ b/.github/workflows/commitlint.yml
@@ -0,0 +1,18 @@
+name: "Commit Linter"
+on: pull_request
+jobs:
+ lint-commits:
+ runs-on: ubuntu-latest
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ steps:
+ - uses: actions/checkout@v2.3.1
+ with:
+ fetch-depth: 0
+ - run: npm install --save-dev @commitlint/cli
+ - run: |
+ if [[ "$(gh pr view ${{ github.event.pull_request.number }} --json commits --jq '.[][0].messageHeadline')" == vim-patch* ]];then
+ npx commitlint --from HEAD~1 --to HEAD --verbose --help-url https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#commit-messages --config .github/workflows/commitlint.config_patch.js
+ else
+ npx commitlint --from HEAD~1 --to HEAD --verbose --help-url https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#commit-messages --config .github/workflows/commitlint.config.js
+ fi
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2a2deaeaa5..366892b522 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,7 +8,7 @@ If you want to help but don't know where to start, here are some
low-risk/isolated tasks:
- [Merge a Vim patch].
-- Try a [good first issue](../../labels/good%20first%20issue) or [complexity:low] issue.
+- Try a [good first issue](../../labels/good-first-issue) or [complexity:low] issue.
- Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or
[Coverity](#coverity).
@@ -86,15 +86,35 @@ the VCS/git logs more valuable. The general structure of a commit message is as
[optional footer(s)]
```
-- **Prefix the commit subject with a _type_:** `doc:`, `test:`
- `runtime:`, ...
- - Subject line for commits with only style/lint changes can be a single
- word: `style` or `lint`.
-- **Add the optional scope following <type> if possible:** `(lsp)`, `(treesitter)`, `(multigrid)`, ...
+- Prefix the commit subject with one of the following _types_:
+ - `build`: all changes related to the build system (involving scripts, configurations or tools) and package dependencies.
+ - `ci`: all changes related to the continuous integration and deployment system - involving scripts, configurations or tools.
+ - `docs`: all documentation changes. This includes both external documentation intended for end users as well as internal documentation intended for developers.
+ - `feat`: new abilities or functionality.
+ - `fix`: a bug fix.
+ - `perf`: performance improvements.
+ - `refactor`: modification of the code base which neither adds a feature nor fixes a bug - such as removing redundant code, simplifying the code, renaming variables, etc.
+ - `revert`: revert previous commits.
+ - `test`: all changes related to tests such as refactoring existing tests or adding new tests.
+ - `vim-patch`: all patches from upstream Vim. The commit messages for patches has [slightly different rules](https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim#pull-requests) as not to interfere with existing scripts.
+ - `chore`: Lastly, if none of the types above fits you may use `chore` as the type.
+
+- Append optional scope to _type_ if possible: `(lsp)`, `(treesitter)` or `(float/windows)`.
+
- Try to keep the first line under 72 characters.
+
- A blank line must separate the subject from the description.
-- Breaking changes must be indicated at the very beginning of the footer or body section of a commit. A breaking change must consist of the uppercase text BREAKING CHANGE, followed by a colon, a space, and a description of what has changed about the API.
-- Check your commit message for spelling and grammatical mistakes.
+
+- A breaking API change must be indicated by appending `!` after the type/scope and at the very beginning of the footer with a **BREAKING CHANGE**.
+
+ Example:
+
+ ```
+ refactor(provider)!: drop support for Python 2
+
+ BREAKING CHANGE: refactor to use Python 3 features since Python 2 is no longer supported.
+ ```
+
- Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug."
### Automated builds (CI)
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index d3a5c383e5..2b3d773ca4 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2267,7 +2267,7 @@ static int command_line_changed(CommandLineState *s)
close_preview_windows();
update_screen(SOME_VALID); // Clear 'inccommand' preview.
} else {
- if (s->xpc.xp_context == EXPAND_NOTHING) {
+ if (s->xpc.xp_context == EXPAND_NOTHING && (KeyTyped || vpeekc() == NUL)) {
may_do_incsearch_highlighting(s->firstc, s->count, &s->is_state);
}
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 4012cc5897..96acca4ac7 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -501,7 +501,7 @@ EXTERN volatile int full_screen INIT(= false);
/// Non-zero when only "safe" commands are allowed, e.g. when sourcing .exrc or
/// .vimrc in current directory.
-EXTERN int secure INIT(= false);
+EXTERN int secure INIT(= 0);
/// Non-zero when changing text and jumping to another window/buffer is not
/// allowed.
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index 9cd57affb9..cba372b9d3 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -73,9 +73,6 @@ struct interval {
# include "unicode_tables.generated.h"
#endif
-char_u e_loadlib[] = "E370: Could not load library %s";
-char_u e_loadfunc[] = "E448: Could not load library function %s";
-
// To speed up BYTELEN(); keep a lookup table to quickly get the length in
// bytes of a UTF-8 character from the first byte of a UTF-8 string. Bytes
// which are illegal when used as the first byte have a 1. The NUL byte has
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 95970a77f8..b40ecd22c8 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -770,7 +770,7 @@ void free_all_options(void)
}
} else if (options[i].var != VAR_WIN && (options[i].flags & P_STRING)) {
// buffer-local option: free global value
- free_string_option(*(char_u **)options[i].var);
+ clear_string_option((char_u **)options[i].var);
}
}
}
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index a236adee06..d6c6b064b2 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -2611,7 +2611,6 @@ static int jumpto_tag(
int keep_help // keep help flag (FALSE for cscope)
)
{
- int save_secure;
int save_magic;
bool save_p_ws;
int save_p_scs, save_p_ic;
@@ -2766,9 +2765,6 @@ static int jumpto_tag(
curwin->w_set_curswant = true;
postponed_split = 0;
- save_secure = secure;
- secure = 1;
- ++sandbox;
save_magic = p_magic;
p_magic = false; // always execute with 'nomagic'
// Save value of no_hlsearch, jumping to a tag is not a real search
@@ -2866,21 +2862,26 @@ static int jumpto_tag(
* of the line. May need to correct that here. */
check_cursor();
} else {
- curwin->w_cursor.lnum = 1; /* start command in line 1 */
+ const int save_secure = secure;
+
+ // Setup the sandbox for executing the command from the tags file.
+ secure = 1;
+ sandbox++;
+ curwin->w_cursor.lnum = 1; // start command in line 1
do_cmdline_cmd((char *)pbuf);
retval = OK;
+
+ // When the command has done something that is not allowed make sure
+ // the error message can be seen.
+ if (secure == 2) {
+ wait_return(true);
+ }
+ secure = save_secure;
+ sandbox--;
}
- /*
- * When the command has done something that is not allowed make sure
- * the error message can be seen.
- */
- if (secure == 2)
- wait_return(TRUE);
- secure = save_secure;
p_magic = save_magic;
- --sandbox;
- /* restore no_hlsearch when keeping the old search pattern */
+ // restore no_hlsearch when keeping the old search pattern
if (search_options) {
set_no_hlsearch(save_no_hlsearch);
}
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index bcf2edcc93..48f97be96b 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -1006,6 +1006,9 @@ func Test_Executable()
if catcmd =~ '\<sbin\>' && result =~ '\<bin\>'
call assert_equal('/' .. substitute(catcmd, '\<sbin\>', 'bin', ''), result)
else
+ " /bin/cat and /usr/bin/cat may be hard linked, we could get either
+ let result = substitute(result, '/usr/bin/cat', '/bin/cat', '')
+ let catcmd = substitute(catcmd, 'usr/bin/cat', 'bin/cat', '')
call assert_equal('/' .. catcmd, result)
endif
bwipe
diff --git a/src/nvim/testdir/test_spellfile.vim b/src/nvim/testdir/test_spellfile.vim
index 729467b556..0f48ab8f6f 100644
--- a/src/nvim/testdir/test_spellfile.vim
+++ b/src/nvim/testdir/test_spellfile.vim
@@ -210,6 +210,52 @@ func Test_spellfile_CHECKCOMPOUNDPATTERN()
call delete('XtestCHECKCOMPOUNDPATTERN-utf8.spl')
endfunc
+" Test NOCOMPOUNDSUGS (see :help spell-NOCOMPOUNDSUGS)
+func Test_spellfile_NOCOMPOUNDSUGS()
+ call writefile(['3',
+ \ 'one/c',
+ \ 'two/c',
+ \ 'three/c'], 'XtestNOCOMPOUNDSUGS.dic')
+
+ " pass 0 tests without NOCOMPOUNDSUGS, pass 1 tests with NOCOMPOUNDSUGS
+ for pass in [0, 1]
+ if pass == 0
+ call writefile(['COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff')
+ else
+ call writefile(['NOCOMPOUNDSUGS',
+ \ 'COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff')
+ endif
+
+ mkspell! XtestNOCOMPOUNDSUGS-utf8.spl XtestNOCOMPOUNDSUGS
+ set spell spelllang=XtestNOCOMPOUNDSUGS-utf8.spl
+
+ for goodword in ['one', 'two', 'three',
+ \ 'oneone', 'onetwo', 'onethree',
+ \ 'twoone', 'twotwo', 'twothree',
+ \ 'threeone', 'threetwo', 'threethree',
+ \ 'onetwothree', 'onethreetwo', 'twothreeone', 'oneoneone']
+ call assert_equal(['', ''], spellbadword(goodword), goodword)
+ endfor
+
+ for badword in ['four', 'onetwox', 'onexone']
+ call assert_equal([badword, 'bad'], spellbadword(badword))
+ endfor
+
+ if pass == 0
+ call assert_equal(['one', 'oneone'], spellsuggest('onne', 2))
+ call assert_equal(['onethree', 'one three'], spellsuggest('onethre', 2))
+ else
+ call assert_equal(['one', 'one one'], spellsuggest('onne', 2))
+ call assert_equal(['one three'], spellsuggest('onethre', 2))
+ endif
+ endfor
+
+ set spell& spelllang&
+ call delete('XtestNOCOMPOUNDSUGS.dic')
+ call delete('XtestNOCOMPOUNDSUGS.aff')
+ call delete('XtestNOCOMPOUNDSUGS-utf8.spl')
+endfunc
+
" Test COMMON (better suggestions with common words, see :help spell-COMMON)
func Test_spellfile_COMMON()
call writefile(['7',