Merge #11384 from janlazo/vim-8.1.2293

vim-patch:8.1.{927,2293}
This commit is contained in:
Justin M. Keyes 2019-11-14 00:02:29 -08:00 committed by GitHub
commit e3b08a0fc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 21 deletions

View File

@ -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

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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

View File

@ -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