diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-11-14 00:02:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-14 00:02:29 -0800 |
commit | e3b08a0fc43eef91b51f8166a036e86b5bdf5613 (patch) | |
tree | aab224f640e8986e377c6d5a7615077f6b8d3f7d | |
parent | 570ee5f404966a6ffd9a5241d91adc6a9f5f2c9d (diff) | |
parent | a0c18bf2017ac7d38d13014a810bda44d09dfcbb (diff) | |
download | rneovim-e3b08a0fc43eef91b51f8166a036e86b5bdf5613.tar.gz rneovim-e3b08a0fc43eef91b51f8166a036e86b5bdf5613.tar.bz2 rneovim-e3b08a0fc43eef91b51f8166a036e86b5bdf5613.zip |
Merge #11384 from janlazo/vim-8.1.2293
vim-patch:8.1.{927,2293}
-rw-r--r-- | runtime/doc/options.txt | 4 | ||||
-rw-r--r-- | src/nvim/ops.c | 5 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 20 | ||||
-rw-r--r-- | src/nvim/spell.c | 11 | ||||
-rw-r--r-- | src/nvim/testdir/test_join.vim | 21 |
5 files changed, 40 insertions, 21 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 52d8624935..d29d9c2676 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2242,8 +2242,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'fileformat'* *'ff'* 'fileformat' 'ff' string (Windows default: "dos", - Unix default: "unix", - Macintosh default: "mac") + Unix default: "unix") local to buffer This gives the <EOL> of the current buffer, which is used for reading/writing the buffer from/to a file: @@ -2265,7 +2264,6 @@ A jump table for the options with a short description can be found at |Q_op|. 'fileformats' 'ffs' string (default: Vim+Vi Win32: "dos,unix", Vim Unix: "unix,dos", - Vim Mac: "mac,unix,dos", Vi others: "") global This gives the end-of-line (<EOL>) formats that will be tried when diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 95674f8b40..2301b2159f 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3773,7 +3773,10 @@ int do_join(size_t count, if (insert_space && t > 0) { curr = skipwhite(curr); - if (*curr != ')' && currsize != 0 && endcurr1 != TAB + if (*curr != NUL + && *curr != ')' + && currsize != 0 + && endcurr1 != TAB && (!has_format_option(FO_MBYTE_JOIN) || (utf_ptr2char(curr) < 0x100 && endcurr1 < 0x100)) && (!has_format_option(FO_MBYTE_JOIN2) diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 276427f216..ed57b28029 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -4559,9 +4559,9 @@ static qfline_T *qf_find_closest_entry(qf_list_T *qfl, /// Get the nth quickfix entry below the specified entry treating multiple /// entries on a single line as one. Searches forward in the list. -static qfline_T *qf_get_nth_below_entry(qfline_T *entry, - int *errornr, - linenr_T n) +static void qf_get_nth_below_entry(qfline_T *entry, + int *errornr, + linenr_T n) { while (n-- > 0 && !got_int) { qfline_T *first_entry = entry; @@ -4582,15 +4582,13 @@ static qfline_T *qf_get_nth_below_entry(qfline_T *entry, entry = entry->qf_next; (*errornr)++; } - - return entry; } /// Get the nth quickfix entry above the specified entry treating multiple /// entries on a single line as one. Searches backwards in the list. -static qfline_T *qf_get_nth_above_entry(qfline_T *entry, - int *errornr, - linenr_T n) +static void qf_get_nth_above_entry(qfline_T *entry, + int *errornr, + linenr_T n) { while (n-- > 0 && !got_int) { if (entry->qf_prev == NULL @@ -4604,8 +4602,6 @@ static qfline_T *qf_get_nth_above_entry(qfline_T *entry, // If multiple entries are on the same line, then use the first entry entry = qf_find_first_entry_on_line(entry, errornr); } - - return entry; } /// Find the n'th quickfix entry adjacent to line 'lnum' in buffer 'bnr' in the @@ -4629,9 +4625,9 @@ static int qf_find_nth_adj_entry(qf_list_T *qfl, if (--n > 0) { // Go to the n'th entry in the current buffer if (dir == FORWARD) { - adj_entry = qf_get_nth_below_entry(adj_entry, &errornr, n); + qf_get_nth_below_entry(adj_entry, &errornr, n); } else { - adj_entry = qf_get_nth_above_entry(adj_entry, &errornr, n); + qf_get_nth_above_entry(adj_entry, &errornr, n); } } diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 687c86b4a8..5feb7efda9 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -1910,11 +1910,11 @@ int init_syl_tab(slang_T *slang) // Count the number of syllables in "word". // When "word" contains spaces the syllables after the last space are counted. // Returns zero if syllables are not defines. -static int count_syllables(slang_T *slang, char_u *word) +static int count_syllables(slang_T *slang, const char_u *word) + FUNC_ATTR_NONNULL_ALL { int cnt = 0; bool skip = false; - char_u *p; int len; syl_item_T *syl; int c; @@ -1922,7 +1922,7 @@ static int count_syllables(slang_T *slang, char_u *word) if (slang->sl_syllable == NULL) return 0; - for (p = word; *p != NUL; p += len) { + for (const char_u *p = word; *p != NUL; p += len) { // When running into a space reset counter. if (*p == ' ') { len = 1; @@ -2625,9 +2625,10 @@ static bool spell_mb_isword_class(int cl, const win_T *wp) // Returns true if "p" points to a word character. // Wide version of spell_iswordp(). -static bool spell_iswordp_w(int *p, win_T *wp) +static bool spell_iswordp_w(const int *p, const win_T *wp) + FUNC_ATTR_NONNULL_ALL { - int *s; + const int *s; if (*p < 256 ? wp->w_s->b_spell_ismw[*p] : (wp->w_s->b_spell_ismw_mb != NULL diff --git a/src/nvim/testdir/test_join.vim b/src/nvim/testdir/test_join.vim index 1c97414164..ecb55c9af6 100644 --- a/src/nvim/testdir/test_join.vim +++ b/src/nvim/testdir/test_join.vim @@ -9,6 +9,27 @@ func Test_join_with_count() call setline(1, ['one', 'two', 'three', 'four']) normal 10J call assert_equal('one two three four', getline(1)) + + call setline(1, ['one', '', 'two']) + normal J + call assert_equal('one', getline(1)) + + call setline(1, ['one', ' ', 'two']) + normal J + call assert_equal('one', getline(1)) + + call setline(1, ['one', '', '', 'two']) + normal JJ + call assert_equal('one', getline(1)) + + call setline(1, ['one', ' ', ' ', 'two']) + normal JJ + call assert_equal('one', getline(1)) + + call setline(1, ['one', '', '', 'two']) + normal 2J + call assert_equal('one', getline(1)) + quit! endfunc |