diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/change.c | 3 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 3 | ||||
-rw-r--r-- | src/nvim/file_search.c | 39 |
3 files changed, 15 insertions, 30 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c index 45ff2ceacb..1d545927ad 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -96,8 +96,7 @@ void changed(void) // Create a swap file if that is wanted. // Don't do this for "nofile" and "nowrite" buffer types. - if (curbuf->b_may_swap - && !bt_dontwrite(curbuf)) { + if (curbuf->b_may_swap && !bt_dontwrite(curbuf)) { bool save_need_wait_return = need_wait_return; need_wait_return = false; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index e08e977ff5..69208cff99 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1880,8 +1880,7 @@ int do_write(exarg_T *eap) // Writing to the current file is not allowed in readonly mode // and a file name is required. // "nofile" and "nowrite" buffers cannot be written implicitly either. - if (!other && (bt_dontwrite_msg(curbuf) - || check_fname() == FAIL + if (!other && (bt_dontwrite_msg(curbuf) || check_fname() == FAIL || check_readonly(&eap->forceit, curbuf))) { goto theend; } diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index 2e86e3f7b0..0eb6ad50ff 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -110,16 +110,15 @@ typedef struct ff_stack { typedef struct ff_visited { struct ff_visited *ffv_next; - /* Visited directories are different if the wildcard string are - * different. So we have to save it. - */ + // Visited directories are different if the wildcard string are + // different. So we have to save it. char_u *ffv_wc_path; + // use FileID for comparison (needed because of links), else use filename. bool file_id_valid; FileID file_id; - /* The memory for this struct is allocated according to the length of - * ffv_fname. - */ + // The memory for this struct is allocated according to the length of + // ffv_fname. char_u ffv_fname[1]; // actually longer } ff_visited_T; @@ -510,9 +509,7 @@ void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int le xfree(buf); } - sptr = ff_create_stack_element(ff_expand_buffer, - search_ctx->ffsc_wc_path, - level, 0); + sptr = ff_create_stack_element(ff_expand_buffer, search_ctx->ffsc_wc_path, level, 0); ff_push(search_ctx, sptr); search_ctx->ffsc_file_to_search = vim_strsave(filename); @@ -641,11 +638,8 @@ char_u *vim_findfile(void *search_ctx_arg) * first time (hence stackp->ff_filearray == NULL) */ if (stackp->ffs_filearray == NULL - && ff_check_visited(&search_ctx->ffsc_dir_visited_list - ->ffvl_visited_list, - stackp->ffs_fix_path, - stackp->ffs_wc_path - ) == FAIL) { + && ff_check_visited(&search_ctx->ffsc_dir_visited_list->ffvl_visited_list, + stackp->ffs_fix_path, stackp->ffs_wc_path) == FAIL) { #ifdef FF_VERBOSE if (p_verbose >= 5) { verbose_enter_scroll(); @@ -790,8 +784,7 @@ char_u *vim_findfile(void *search_ctx_arg) stackp->ffs_filearray_cur = 0; stackp->ffs_stage = 0; } else { - rest_of_wildcards = &stackp->ffs_wc_path[ - STRLEN(stackp->ffs_wc_path)]; + rest_of_wildcards = &stackp->ffs_wc_path[STRLEN(stackp->ffs_wc_path)]; } if (stackp->ffs_stage == 0) { @@ -833,23 +826,17 @@ char_u *vim_findfile(void *search_ctx_arg) // if file exists and we didn't already find it if ((path_with_url((char *)file_path) || (os_path_exists(file_path) - && (search_ctx->ffsc_find_what - == FINDFILE_BOTH - || ((search_ctx->ffsc_find_what - == FINDFILE_DIR) + && (search_ctx->ffsc_find_what == FINDFILE_BOTH + || ((search_ctx->ffsc_find_what == FINDFILE_DIR) == os_isdir(file_path))))) #ifndef FF_VERBOSE && (ff_check_visited(&search_ctx->ffsc_visited_list->ffvl_visited_list, - file_path, - (char_u *)"" - ) == OK) + file_path, (char_u *)"") == OK) #endif ) { #ifdef FF_VERBOSE if (ff_check_visited(&search_ctx->ffsc_visited_list->ffvl_visited_list, - file_path, - (char_u *)"" - ) == FAIL) { + file_path, (char_u *)"") == FAIL) { if (p_verbose >= 5) { verbose_enter_scroll(); smsg("Already: %s", file_path); |