Merge #12827 'vim-patch:8.2.{1554,1561,1564,1565,1566}'

This commit is contained in:
Justin M. Keyes 2020-09-02 22:31:31 -07:00 committed by GitHub
commit 3acfefb63e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 14 deletions

View File

@ -236,10 +236,10 @@ au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml
au BufNewFile,BufRead *bsd,*.bsdl setf bsdl au BufNewFile,BufRead *bsd,*.bsdl setf bsdl
" Bazel (http://bazel.io) " Bazel (http://bazel.io)
autocmd BufRead,BufNewFile *.bzl,WORKSPACE,BUILD.bazel setf bzl autocmd BufRead,BufNewFile *.bzl,*.bazel,WORKSPACE setf bzl
if has("fname_case") if has("fname_case")
" There is another check for BUILD further below. " There is another check for BUILD further below.
autocmd BufRead,BufNewFile BUILD setf bzl autocmd BufRead,BufNewFile *.BUILD,BUILD setf bzl
endif endif
" C or lpc " C or lpc
@ -2041,7 +2041,7 @@ au BufNewFile,BufRead bzr_log.* setf bzr
" Bazel build file " Bazel build file
if !has("fname_case") if !has("fname_case")
au BufNewFile,BufRead BUILD setf bzl au BufNewFile,BufRead *.BUILD,BUILD setf bzl
endif endif
" BIND zone " BIND zone

View File

@ -1389,6 +1389,10 @@ static void foldMarkAdjustRecurse(
linenr_T last; linenr_T last;
linenr_T top; linenr_T top;
if (gap->ga_len == 0) {
return;
}
/* In Insert mode an inserted line at the top of a fold is considered part /* In Insert mode an inserted line at the top of a fold is considered part
* of the fold, otherwise it isn't. */ * of the fold, otherwise it isn't. */
if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM)
@ -2738,7 +2742,8 @@ static void truncate_fold(win_T *const wp, fold_T *fp, linenr_T end)
} }
#define FOLD_END(fp) ((fp)->fd_top + (fp)->fd_len - 1) #define FOLD_END(fp) ((fp)->fd_top + (fp)->fd_len - 1)
#define VALID_FOLD(fp, gap) ((fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) #define VALID_FOLD(fp, gap) \
((gap)->ga_len > 0 && (fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len))
#define FOLD_INDEX(fp, gap) ((size_t)(fp - ((fold_T *)(gap)->ga_data))) #define FOLD_INDEX(fp, gap) ((size_t)(fp - ((fold_T *)(gap)->ga_data)))
void foldMoveRange( void foldMoveRange(
win_T *const wp, garray_T *gap, win_T *const wp, garray_T *gap,

View File

@ -5765,14 +5765,14 @@ cleanup_suggestions (
) )
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
suggest_T *stp = &SUG(*gap, 0);
if (gap->ga_len > 0) { if (gap->ga_len > 0) {
// Sort the list. // Sort the list.
qsort(gap->ga_data, (size_t)gap->ga_len, sizeof(suggest_T), sug_compare); qsort(gap->ga_data, (size_t)gap->ga_len, sizeof(suggest_T), sug_compare);
// Truncate the list to the number of suggestions that will be displayed. // Truncate the list to the number of suggestions that will be displayed.
if (gap->ga_len > keep) { if (gap->ga_len > keep) {
suggest_T *const stp = &SUG(*gap, 0);
for (int i = keep; i < gap->ga_len; i++) { for (int i = keep; i < gap->ga_len; i++) {
xfree(stp[i].st_word); xfree(stp[i].st_word);
} }

View File

@ -984,16 +984,18 @@ nextone:
static char_u *read_cnt_string(FILE *fd, int cnt_bytes, int *cntp) static char_u *read_cnt_string(FILE *fd, int cnt_bytes, int *cntp)
{ {
int cnt = 0; int cnt = 0;
int i;
char_u *str; char_u *str;
// read the length bytes, MSB first // read the length bytes, MSB first
for (i = 0; i < cnt_bytes; ++i) for (int i = 0; i < cnt_bytes; i++) {
cnt = (cnt << 8) + getc(fd); const int c = getc(fd);
if (cnt < 0) {
if (c == EOF) {
*cntp = SP_TRUNCERROR; *cntp = SP_TRUNCERROR;
return NULL; return NULL;
} }
cnt = (cnt << 8) + (unsigned)c;
}
*cntp = cnt; *cntp = cnt;
if (cnt == 0) if (cnt == 0)
return NULL; // nothing to read, return NULL return NULL; // nothing to read, return NULL
@ -3038,9 +3040,9 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
spin->si_msg_count = 999999; spin->si_msg_count = 999999;
// Read and ignore the first line: word count. // Read and ignore the first line: word count.
(void)vim_fgets(line, MAXLINELEN, fd); if (vim_fgets(line, MAXLINELEN, fd) || !ascii_isdigit(*skipwhite(line))) {
if (!ascii_isdigit(*skipwhite(line)))
EMSG2(_("E760: No word count in %s"), fname); EMSG2(_("E760: No word count in %s"), fname);
}
// Read all the lines in the file one by one. // Read all the lines in the file one by one.
// The words are converted to 'encoding' here, before being added to // The words are converted to 'encoding' here, before being added to

View File

@ -75,6 +75,7 @@ let s:filename_checks = {
\ 'ave': ['file.ave'], \ 'ave': ['file.ave'],
\ 'awk': ['file.awk', 'file.gawk'], \ 'awk': ['file.awk', 'file.gawk'],
\ 'b': ['file.mch', 'file.ref', 'file.imp'], \ 'b': ['file.mch', 'file.ref', 'file.imp'],
\ 'bzl': ['file.bazel', 'file.bzl', 'WORKSPACE'],
\ 'bc': ['file.bc'], \ 'bc': ['file.bc'],
\ 'bdf': ['file.bdf'], \ 'bdf': ['file.bdf'],
\ 'bib': ['file.bib'], \ 'bib': ['file.bib'],
@ -526,6 +527,7 @@ let s:filename_checks = {
let s:filename_case_checks = { let s:filename_case_checks = {
\ 'modula2': ['file.DEF', 'file.MOD'], \ 'modula2': ['file.DEF', 'file.MOD'],
\ 'bzl': ['file.BUILD', 'BUILD'],
\ } \ }
func CheckItems(checks) func CheckItems(checks)