From 2eddbacd6dc17c84e4bdc41e60e81949a36bb973 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 25 Aug 2022 12:45:21 +0100 Subject: [PATCH 01/10] patch 9.0.0261: bufload() reads a file even if the name is not a file name Problem: bufload() reads a file even if the name is not a file name. (Cyker Way) Solution: Do not read the file when the buffer name is not a file name. (closes #10975) --- runtime/doc/builtin.txt | 6 ++++-- src/buffer.c | 3 +++ src/testdir/test_functions.vim | 7 +++++++ src/version.c | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index c1dea37ad0..7df5e9f099 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1179,7 +1179,8 @@ browsedir({title}, {initdir}) browsing is not possible, an empty string is returned. bufadd({name}) *bufadd()* - Add a buffer to the buffer list with String {name}. + Add a buffer to the buffer list with name {name} (must be a + String). If a buffer for file {name} already exists, return that buffer number. Otherwise return the buffer number of the newly created buffer. When {name} is an empty string then a new @@ -1232,7 +1233,8 @@ bufload({buf}) *bufload()* Ensure the buffer {buf} is loaded. When the buffer name refers to an existing file then the file is read. Otherwise the buffer will be empty. If the buffer was already loaded - then there is no change. + then there is no change. If the buffer is not related to a + file the no file is read (e.g., when 'buftype' is "nofile"). If there is an existing swap file for the file of the buffer, there will be no dialog, the buffer will be loaded anyway. The {buf} argument is used like with |bufexists()|. diff --git a/src/buffer.c b/src/buffer.c index fba6c218fd..cfed0f327c 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -220,7 +220,10 @@ open_buffer( // mark cursor position as being invalid curwin->w_valid = 0; + // Read the file if there is one. if (curbuf->b_ffname != NULL + && !bt_quickfix(curbuf) + && !bt_nofilename(curbuf) #ifdef FEAT_NETBEANS_INTG && netbeansReadFile #endif diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 38cd7930af..68970407ce 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -2368,6 +2368,13 @@ func Test_bufadd_bufload() exe 'bwipe ' .. buf2 call assert_equal(0, bufexists(buf2)) + " when 'buftype' is "nofile" then bufload() does not read the file + bwipe! XotherName + let buf = bufadd('XotherName') + call setbufvar(buf, '&bt', 'nofile') + call bufload(buf) + call assert_equal([''], getbufline(buf, 1, '$')) + bwipe someName bwipe XotherName call assert_equal(0, bufexists('someName')) diff --git a/src/version.c b/src/version.c index 02c20f03f6..867d971746 100644 --- a/src/version.c +++ b/src/version.c @@ -731,6 +731,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 261, /**/ 260, /**/ From 2e6dcbc4450c98bd12faace5d77a65f2afddae44 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 25 Aug 2022 13:54:16 +0100 Subject: [PATCH 02/10] patch 9.0.0262: build failure without the +quickfix feature Problem: Build failure without the +quickfix feature. Solution: Add #ifdef. --- src/buffer.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/buffer.c b/src/buffer.c index cfed0f327c..f2f32e1a62 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -222,7 +222,9 @@ open_buffer( // Read the file if there is one. if (curbuf->b_ffname != NULL +#ifdef FEAT_QUICKFIX && !bt_quickfix(curbuf) +#endif && !bt_nofilename(curbuf) #ifdef FEAT_NETBEANS_INTG && netbeansReadFile diff --git a/src/version.c b/src/version.c index 867d971746..8ca27a523b 100644 --- a/src/version.c +++ b/src/version.c @@ -731,6 +731,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 262, /**/ 261, /**/ From 6d4b2f54df5d533eb0794331f38445a6ca5d3a3f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 25 Aug 2022 15:11:15 +0100 Subject: [PATCH 03/10] patch 9.0.0263: too many #ifdefs Problem: Too many #ifdefs. Solution: Make some functions always available. --- src/buffer.c | 53 +++++++++++++----------------------------------- src/bufwrite.c | 8 -------- src/change.c | 6 +----- src/drawscreen.c | 6 +----- src/errors.h | 2 +- src/evalbuffer.c | 6 +----- src/ex_cmds.c | 13 ++---------- src/ex_cmds2.c | 2 -- src/ex_docmd.c | 2 -- src/fileio.c | 6 ------ src/netbeans.c | 5 +---- src/session.c | 17 +++------------- src/version.c | 2 ++ src/viminfo.c | 10 +-------- src/window.c | 6 ------ 15 files changed, 27 insertions(+), 117 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index f2f32e1a62..ebba88b371 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -222,9 +222,7 @@ open_buffer( // Read the file if there is one. if (curbuf->b_ffname != NULL -#ifdef FEAT_QUICKFIX && !bt_quickfix(curbuf) -#endif && !bt_nofilename(curbuf) #ifdef FEAT_NETBEANS_INTG && netbeansReadFile @@ -1328,11 +1326,7 @@ do_buffer_ext( return FAIL; } #ifdef FEAT_PROP_POPUP - if ((flags & DOBUF_NOPOPUP) && bt_popup(buf) -# ifdef FEAT_TERMINAL - && !bt_terminal(buf) -#endif - ) + if ((flags & DOBUF_NOPOPUP) && bt_popup(buf) && !bt_terminal(buf)) return OK; #endif @@ -1445,11 +1439,7 @@ do_buffer_ext( { // Skip current and unlisted bufs. Also skip a quickfix // buffer, it might be deleted soon. - if (buf == curbuf || !buf->b_p_bl -#if defined(FEAT_QUICKFIX) - || bt_quickfix(buf) -#endif - ) + if (buf == curbuf || !buf->b_p_bl || bt_quickfix(buf)) buf = NULL; else if (buf->b_ml.ml_mfp == NULL) { @@ -1487,10 +1477,7 @@ do_buffer_ext( } // in non-help buffer, try to skip help buffers, and vv if (buf->b_help == curbuf->b_help && buf->b_p_bl -#if defined(FEAT_QUICKFIX) - && !bt_quickfix(buf) -#endif - ) + && !bt_quickfix(buf)) { if (buf->b_ml.ml_mfp != NULL) // found loaded buffer break; @@ -1508,11 +1495,7 @@ do_buffer_ext( if (buf == NULL) // No loaded buffer, find listed one { FOR_ALL_BUFFERS(buf) - if (buf->b_p_bl && buf != curbuf -#if defined(FEAT_QUICKFIX) - && !bt_quickfix(buf) -#endif - ) + if (buf->b_p_bl && buf != curbuf && !bt_quickfix(buf)) break; } if (buf == NULL) // Still no buffer, just take one @@ -1521,10 +1504,8 @@ do_buffer_ext( buf = curbuf->b_next; else buf = curbuf->b_prev; -#if defined(FEAT_QUICKFIX) if (bt_quickfix(buf)) buf = NULL; -#endif } } @@ -1987,9 +1968,7 @@ curbuf_reusable(void) && curbuf->b_ffname == NULL && curbuf->b_nwindows <= 1 && (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY()) -#if defined(FEAT_QUICKFIX) && !bt_quickfix(curbuf) -#endif && !curbufIsChanged()); } @@ -3787,15 +3766,9 @@ fileinfo( vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s", curbufIsChanged() ? (shortmess(SHM_MOD) ? " [+]" : _(" [Modified]")) : " ", - (curbuf->b_flags & BF_NOTEDITED) -#ifdef FEAT_QUICKFIX - && !bt_dontwrite(curbuf) -#endif + (curbuf->b_flags & BF_NOTEDITED) && !bt_dontwrite(curbuf) ? _("[Not edited]") : "", - (curbuf->b_flags & BF_NEW) -#ifdef FEAT_QUICKFIX - && !bt_dontwrite(curbuf) -#endif + (curbuf->b_flags & BF_NEW) && !bt_dontwrite(curbuf) ? new_file_message() : "", (curbuf->b_flags & BF_READERR) ? _("[Read errors]") : "", curbuf->b_p_ro ? (shortmess(SHM_RO) ? _("[RO]") @@ -5676,27 +5649,31 @@ bt_normal(buf_T *buf) return buf != NULL && buf->b_p_bt[0] == NUL; } -#if defined(FEAT_QUICKFIX) || defined(PROTO) /* * Return TRUE if "buf" is the quickfix buffer. */ int bt_quickfix(buf_T *buf) { +#ifdef FEAT_QUICKFIX return buf != NULL && buf->b_p_bt[0] == 'q'; -} +#else + return FALSE; #endif +} -#if defined(FEAT_TERMINAL) || defined(PROTO) /* * Return TRUE if "buf" is a terminal buffer. */ int bt_terminal(buf_T *buf) { +#if defined(FEAT_TERMINAL) return buf != NULL && buf->b_p_bt[0] == 't'; -} +#else + return FALSE; #endif +} /* * Return TRUE if "buf" is a help buffer. @@ -5764,7 +5741,6 @@ bt_dontwrite(buf_T *buf) || buf->b_p_bt[0] == 'p'); } -#if defined(FEAT_QUICKFIX) || defined(PROTO) int bt_dontwrite_msg(buf_T *buf) { @@ -5775,7 +5751,6 @@ bt_dontwrite_msg(buf_T *buf) } return FALSE; } -#endif /* * Return TRUE if the buffer should be hidden, according to 'hidden', ":hide" diff --git a/src/bufwrite.c b/src/bufwrite.c index d7c3034766..5db8f2983b 100644 --- a/src/bufwrite.c +++ b/src/bufwrite.c @@ -742,9 +742,7 @@ buf_write( && reset_changed && whole && buf == curbuf -#ifdef FEAT_QUICKFIX && !bt_nofilename(buf) -#endif && !filtering && (!append || vim_strchr(p_cpo, CPO_FNAMEAPP) != NULL) && vim_strchr(p_cpo, CPO_FNAMEW) != NULL) @@ -813,11 +811,9 @@ buf_write( if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEAPPENDCMD, sfname, sfname, FALSE, curbuf, eap))) { -#ifdef FEAT_QUICKFIX if (overwriting && bt_nofilename(curbuf)) nofile_err = TRUE; else -#endif apply_autocmds_exarg(EVENT_FILEAPPENDPRE, sfname, sfname, FALSE, curbuf, eap); } @@ -846,11 +842,9 @@ buf_write( } else { -#ifdef FEAT_QUICKFIX if (overwriting && bt_nofilename(curbuf)) nofile_err = TRUE; else -#endif apply_autocmds_exarg(EVENT_BUFWRITEPRE, sfname, sfname, FALSE, curbuf, eap); } @@ -860,11 +854,9 @@ buf_write( if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEWRITECMD, sfname, sfname, FALSE, curbuf, eap))) { -#ifdef FEAT_QUICKFIX if (overwriting && bt_nofilename(curbuf)) nofile_err = TRUE; else -#endif apply_autocmds_exarg(EVENT_FILEWRITEPRE, sfname, sfname, FALSE, curbuf, eap); } diff --git a/src/change.c b/src/change.c index 51ffe28524..71ad9eaf87 100644 --- a/src/change.c +++ b/src/change.c @@ -100,11 +100,7 @@ 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 -#ifdef FEAT_QUICKFIX - && !bt_dontwrite(curbuf) -#endif - ) + if (curbuf->b_may_swap && !bt_dontwrite(curbuf)) { int save_need_wait_return = need_wait_return; diff --git a/src/drawscreen.c b/src/drawscreen.c index a9b3643ed8..ff0f2eaebd 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -482,11 +482,7 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED) len += (int)STRLEN(p + len); } #endif - if (bufIsChanged(wp->w_buffer) -#ifdef FEAT_TERMINAL - && !bt_terminal(wp->w_buffer) -#endif - ) + if (bufIsChanged(wp->w_buffer) && !bt_terminal(wp->w_buffer)) { vim_snprintf((char *)p + len, MAXPATHL - len, "%s", "[+]"); len += (int)STRLEN(p + len); diff --git a/src/errors.h b/src/errors.h index 940d055940..edd25ce03c 100644 --- a/src/errors.h +++ b/src/errors.h @@ -954,9 +954,9 @@ EXTERN char e_at_bottom_of_quickfix_stack[] INIT(= N_("E380: At bottom of quickfix stack")); EXTERN char e_at_top_of_quickfix_stack[] INIT(= N_("E381: At top of quickfix stack")); +#endif EXTERN char e_cannot_write_buftype_option_is_set[] INIT(= N_("E382: Cannot write, 'buftype' option is set")); -#endif EXTERN char e_invalid_search_string_str[] INIT(= N_("E383: Invalid search string: %s")); EXTERN char e_search_hit_top_without_match_for_str[] diff --git a/src/evalbuffer.c b/src/evalbuffer.c index fe41f08487..15ac58021a 100644 --- a/src/evalbuffer.c +++ b/src/evalbuffer.c @@ -93,11 +93,7 @@ find_buffer(typval_T *avar) // buffer, these don't use the full path. FOR_ALL_BUFFERS(buf) if (buf->b_fname != NULL - && (path_with_url(buf->b_fname) -#ifdef FEAT_QUICKFIX - || bt_nofilename(buf) -#endif - ) + && (path_with_url(buf->b_fname) || bt_nofilename(buf)) && STRCMP(buf->b_fname, avar->vval.v_string) == 0) break; } diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 87a7b50e06..01518ff64d 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1677,12 +1677,7 @@ append_redir( (char *)opt, (char *)fname); } else - vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), -#ifdef FEAT_QUICKFIX - " %s %s", -#else - " %s%s", // " > %s" causes problems on Amiga -#endif + vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), " %s %s", (char *)opt, (char *)fname); } @@ -1947,11 +1942,7 @@ do_write(exarg_T *eap) * and a file name is required. * "nofile" and "nowrite" buffers cannot be written implicitly either. */ - if (!other && ( -#ifdef FEAT_QUICKFIX - bt_dontwrite_msg(curbuf) || -#endif - check_fname() == FAIL + if (!other && (bt_dontwrite_msg(curbuf) || check_fname() == FAIL #ifdef UNIX || check_writable(curbuf->b_ffname) == FAIL #endif diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 2de1798b18..a41e0675b7 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -27,10 +27,8 @@ autowrite(buf_T *buf, int forceit) bufref_T bufref; if (!(p_aw || p_awa) || !p_write -#ifdef FEAT_QUICKFIX // never autowrite a "nofile" or "nowrite" buffer || bt_dontwrite(buf) -#endif || (!forceit && buf->b_p_ro) || buf->b_ffname == NULL) return FAIL; set_bufref(&bufref, buf); diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 382029a65a..b9ff423b64 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -55,8 +55,6 @@ static int getargopt(exarg_T *eap); # define qf_history ex_ni # define ex_helpgrep ex_ni # define ex_vimgrep ex_ni -#endif -#if !defined(FEAT_QUICKFIX) # define ex_cclose ex_ni # define ex_copen ex_ni # define ex_cwindow ex_ni diff --git a/src/fileio.c b/src/fileio.c index 7750c525b7..6d063a5ab7 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -514,9 +514,7 @@ readfile( // Create a swap file now, so that other Vims are warned // that we are editing this file. Don't do this for a // "nofile" or "nowrite" buffer type. -#ifdef FEAT_QUICKFIX if (!bt_dontwrite(curbuf)) -#endif { check_need_swap(newfile); // SwapExists autocommand may mess things up @@ -595,9 +593,7 @@ readfile( // Create a swap file now, so that other Vims are warned that we are // editing this file. // Don't do this for a "nofile" or "nowrite" buffer type. -#ifdef FEAT_QUICKFIX if (!bt_dontwrite(curbuf)) -#endif { check_need_swap(newfile); if (!read_stdin && (curbuf != old_curbuf @@ -3407,9 +3403,7 @@ shorten_buf_fname(buf_T *buf, char_u *dirname, int force) char_u *p; if (buf->b_fname != NULL -#ifdef FEAT_QUICKFIX && !bt_nofilename(buf) -#endif && !path_with_url(buf->b_fname) && (force || buf->b_sfname == NULL diff --git a/src/netbeans.c b/src/netbeans.c index f9ef19a140..523cda08d7 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -2152,10 +2152,7 @@ nb_do_cmd( if (p_write && !buf->bufp->b_p_ro && buf->bufp->b_ffname != NULL -#ifdef FEAT_QUICKFIX - && !bt_dontwrite(buf->bufp) -#endif - ) + && !bt_dontwrite(buf->bufp)) { bufref_T bufref; diff --git a/src/session.c b/src/session.c index fb9d1404ad..ddf5d21d11 100644 --- a/src/session.c +++ b/src/session.c @@ -148,11 +148,8 @@ ses_do_win(win_T *wp) && term_should_restore(wp->w_buffer); #endif if (wp->w_buffer->b_fname == NULL -#ifdef FEAT_QUICKFIX // When 'buftype' is "nofile" can't restore the window contents. - || bt_nofilename(wp->w_buffer) -#endif - ) + || bt_nofilename(wp->w_buffer)) return (ssop_flags & SSOP_BLANK); if (bt_help(wp->w_buffer)) return (ssop_flags & SSOP_HELP); @@ -374,10 +371,7 @@ put_view( # endif // Load the file. else if (wp->w_buffer->b_ffname != NULL -# ifdef FEAT_QUICKFIX - && !bt_nofilename(wp->w_buffer) -# endif - ) + && !bt_nofilename(wp->w_buffer)) { // Editing a file in this buffer: use ":edit file". // This may have side effects! (e.g., compressed or network file). @@ -708,11 +702,9 @@ makeopens( { if (!(only_save_windows && buf->b_nwindows == 0) && !(buf->b_help && !(ssop_flags & SSOP_HELP)) -#ifdef FEAT_TERMINAL // Skip terminal buffers: finished ones are not useful, others // will be resurrected and result in a new buffer. && !bt_terminal(buf) -#endif && buf->b_fname != NULL && buf->b_p_bl) { @@ -818,10 +810,7 @@ makeopens( if (ses_do_win(wp) && wp->w_buffer->b_ffname != NULL && !bt_help(wp->w_buffer) -#ifdef FEAT_QUICKFIX - && !bt_nofilename(wp->w_buffer) -#endif - ) + && !bt_nofilename(wp->w_buffer)) { if (need_tabnext && put_line(fd, "tabnext") == FAIL) goto fail; diff --git a/src/version.c b/src/version.c index 8ca27a523b..ce61bbc3d0 100644 --- a/src/version.c +++ b/src/version.c @@ -731,6 +731,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 263, /**/ 262, /**/ diff --git a/src/viminfo.c b/src/viminfo.c index cc28a12097..cd734130f6 100644 --- a/src/viminfo.c +++ b/src/viminfo.c @@ -434,12 +434,8 @@ write_viminfo_bufferlist(FILE *fp) { if (buf->b_fname == NULL || !buf->b_p_bl -#ifdef FEAT_QUICKFIX || bt_quickfix(buf) -#endif -#ifdef FEAT_TERMINAL || bt_terminal(buf) -#endif || removable(buf->b_ffname)) continue; @@ -1994,11 +1990,7 @@ write_buffer_marks(buf_T *buf, FILE *fp_out) static int skip_for_viminfo(buf_T *buf) { - return -#ifdef FEAT_TERMINAL - bt_terminal(buf) || -#endif - removable(buf->b_ffname); + return bt_terminal(buf) || removable(buf->b_ffname); } /* diff --git a/src/window.c b/src/window.c index f52aa64f8a..3ee65fbf4a 100644 --- a/src/window.c +++ b/src/window.c @@ -172,12 +172,10 @@ do_window( case 's': CHECK_CMDWIN; reset_VIsual_and_resel(); // stop Visual mode -#ifdef FEAT_QUICKFIX // When splitting the quickfix window open a new buffer in it, // don't replicate the quickfix buffer. if (bt_quickfix(curbuf)) goto newwindow; -#endif #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif @@ -189,12 +187,10 @@ do_window( case 'v': CHECK_CMDWIN; reset_VIsual_and_resel(); // stop Visual mode -#ifdef FEAT_QUICKFIX // When splitting the quickfix window open a new buffer in it, // don't replicate the quickfix buffer. if (bt_quickfix(curbuf)) goto newwindow; -#endif #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif @@ -228,9 +224,7 @@ do_window( case 'n': CHECK_CMDWIN; reset_VIsual_and_resel(); // stop Visual mode -#ifdef FEAT_QUICKFIX newwindow: -#endif if (Prenum) // window height vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%ld", Prenum); From b213703f358e1e10ba0affb3729c09ccb2c88ea3 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 25 Aug 2022 15:21:24 +0100 Subject: [PATCH 04/10] patch 9.0.0264: CI still runs on Ubuntu 18.04 Problem: CI still runs on Ubuntu 18.04. Solution: Run CI on Ubuntu 20.04. (closes #10582) --- .github/workflows/ci.yml | 9 ++------- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61723cdf3f..1e20067625 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ concurrency: jobs: linux: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 env: CC: ${{ matrix.compiler }} @@ -167,11 +167,6 @@ jobs: # Use llvm-cov instead of gcov when compiler is clang. ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov fi - # Setup lua5.3 manually since its package doesn't provide alternative. - # https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212 - if [[ ${CONFOPT} =~ luainterp ]]; then - sudo update-alternatives --install /usr/bin/lua lua /usr/bin/lua5.3 10 - fi sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 sudo usermod -a -G audio "${USER}" sudo bash ci/setup-xvfb.sh @@ -268,7 +263,7 @@ jobs: done # coveralls: - # runs-on: ubuntu-18.04 + # runs-on: ubuntu-20.04 # # needs: linux # if: always() && github.event_name != 'pull_request' diff --git a/src/version.c b/src/version.c index ce61bbc3d0..c17f7f866c 100644 --- a/src/version.c +++ b/src/version.c @@ -731,6 +731,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 264, /**/ 263, /**/ From f80f40a55ccff0a4331c5fbd1ac446511f622ed0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 25 Aug 2022 16:02:23 +0100 Subject: [PATCH 05/10] patch 9.0.0265: no good reason why the "gf" command isn't in the tiny version Problem: No good reason why the "gf" command is not in the tiny version. Solution: Graduate the file_in_path feature. --- runtime/doc/builtin.txt | 5 ++--- runtime/doc/cmdline.txt | 3 --- runtime/doc/editing.txt | 4 ---- runtime/doc/options.txt | 4 ---- runtime/doc/tabpage.txt | 2 -- runtime/doc/windows.txt | 8 -------- src/alloc.c | 6 ++---- src/buffer.c | 2 -- src/errors.h | 4 ---- src/evalfunc.c | 8 +------- src/ex_docmd.c | 17 +---------------- src/feature.h | 18 +++++------------- src/filepath.c | 10 ---------- src/findfile.c | 10 ---------- src/misc2.c | 8 ++------ src/normal.c | 6 ------ src/option.c | 14 +------------- src/option.h | 6 ------ src/optiondefs.h | 14 +------------- src/optionstr.c | 2 -- src/register.c | 4 ---- src/structs.h | 2 -- src/testdir/test_options.vim | 1 - src/version.c | 6 ++---- src/window.c | 13 +++---------- 25 files changed, 20 insertions(+), 157 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 7df5e9f099..49d538d1e7 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2736,8 +2736,6 @@ finddir({name} [, {path} [, {count}]]) *finddir()* Returns an empty string if the directory is not found. This is quite similar to the ex-command `:find`. - {only available when compiled with the |+file_in_path| - feature} Can also be used as a |method|: > GetName()->finddir() @@ -10532,7 +10530,8 @@ ex_extra |+ex_extra| (always true) extra_search Compiled with support for |'incsearch'| and |'hlsearch'| farsi Support for Farsi was removed |farsi|. -file_in_path Compiled with support for |gf| and || +file_in_path Compiled with support for |gf| and || (always + true) filterpipe When 'shelltemp' is off pipes are used for shell read/write/filter commands find_in_path Compiled with support for include file searches diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index e09ec39a54..e29369cb66 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -199,9 +199,6 @@ CTRL-R CTRL-L *c_CTRL-R_CTRL-L* *c__* currently displayed match is used. With CTRL-W the part of the word that was already typed is not inserted again. - CTRL-F and CTRL-P: {only when |+file_in_path| feature is - included} - *c_CTRL-R_CTRL-R* *c__* *c_CTRL-R_CTRL-O* *c__* CTRL-R CTRL-R {register CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L} diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 0ce48af0d7..7eaf48d51f 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -247,8 +247,6 @@ If you want to keep the changed buffer without saving it, switch on the *:fin* *:find* :fin[d][!] [++opt] [+cmd] {file} Find {file} in 'path' and then |:edit| it. - {not available when the |+file_in_path| feature was - disabled at compile time} :{count}fin[d][!] [++opt] [+cmd] {file} Just like ":find", but use the {count} match in @@ -322,8 +320,6 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is For Unix the '~' character is expanded, like in "~user/file". Environment variables are expanded too |expand-env|. - {not available when the |+file_in_path| feature was - disabled at compile time} *v_gf* {Visual}[count]gf Same as "gf", but the highlighted text is used as the diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 9141763649..1a21be8ba1 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1559,8 +1559,6 @@ A jump table for the options with a short description can be found at |Q_op|. *'cdpath'* *'cd'* *E344* *E346* 'cdpath' 'cd' string (default: equivalent to $CDPATH or ",,") global - {not available when compiled without the - |+file_in_path| feature} This is a list of directories which will be searched when using the |:cd|, |:tcd| and |:lcd| commands, provided that the directory being searched for has a relative path, not an absolute part starting with @@ -7726,8 +7724,6 @@ A jump table for the options with a short description can be found at |Q_op|. *'suffixesadd'* *'sua'* 'suffixesadd' 'sua' string (default "") local to buffer - {not available when compiled without the - |+file_in_path| feature} Comma-separated list of suffixes, which are used when searching for a file for the "gf", "[I", etc. commands. Example: > :set suffixesadd=.java diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 54ac11e17a..a010e2fd27 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -81,8 +81,6 @@ For the related autocommands see |tabnew-autocmd|. :[count]tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind* Open a new tab page and edit {file} in 'path', like with |:find|. For [count] see |:tabnew| above. - {not available when the |+file_in_path| feature was disabled - at compile time} :[count]tab {cmd} *:tab* Execute {cmd} and when it opens a new window open a new tab diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 5c648971f9..13f648f191 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -843,30 +843,22 @@ CTRL-W CTRL-F Split current window in two. Edit file name under cursor. If the name is a hypertext link that looks like "type://machine/path", only "/path" is used. If a count is given, the count'th matching file is edited. - {not available when the |+file_in_path| feature was disabled - at compile time} CTRL-W F *CTRL-W_F* Split current window in two. Edit file name under cursor and jump to the line number following the file name. See |gF| for details on how the line number is obtained. - {not available when the |+file_in_path| feature was disabled - at compile time} CTRL-W gf *CTRL-W_gf* Open a new tab page and edit the file name under the cursor. Like "tab split" and "gf", but the new tab page isn't created if the file does not exist. - {not available when the |+file_in_path| feature was disabled - at compile time} CTRL-W gF *CTRL-W_gF* Open a new tab page and edit the file name under the cursor and jump to the line number following the file name. Like "tab split" and "gF", but the new tab page isn't created if the file does not exist. - {not available when the |+file_in_path| feature was disabled - at compile time} CTRL-W gt *CTRL-W_gt* Go to next tab page, same as `gt`. diff --git a/src/alloc.c b/src/alloc.c index 7ca20c7189..932d67a127 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -158,10 +158,10 @@ alloc(size_t size) void * alloc_id(size_t size, alloc_id_T id UNUSED) { -#ifdef FEAT_EVAL +# ifdef FEAT_EVAL if (alloc_fail_id == id && alloc_does_fail(size)) return NULL; -#endif +# endif return lalloc(size, TRUE); } #endif @@ -425,9 +425,7 @@ free_all_mem(void) } free_titles(); -# if defined(FEAT_SEARCHPATH) free_findfile(); -# endif // Obviously named calls. free_all_autocmds(); diff --git a/src/buffer.c b/src/buffer.c index ebba88b371..cec2abbb2c 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2324,9 +2324,7 @@ free_buf_options( clear_string_option(&buf->b_s.b_p_spl); clear_string_option(&buf->b_s.b_p_spo); #endif -#ifdef FEAT_SEARCHPATH clear_string_option(&buf->b_p_sua); -#endif clear_string_option(&buf->b_p_ft); clear_string_option(&buf->b_p_cink); clear_string_option(&buf->b_p_cino); diff --git a/src/errors.h b/src/errors.h index edd25ce03c..b903ae7d2c 100644 --- a/src/errors.h +++ b/src/errors.h @@ -853,7 +853,6 @@ EXTERN char e_out_of_memory_allocating_nr_bytes[] EXTERN char e_invalid_path_number_must_be_at_end_of_path_or_be_followed_by_str[] INIT(= N_("E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'.")); #endif -#ifdef FEAT_SEARCHPATH EXTERN char e_cant_find_directory_str_in_cdpath[] INIT(= N_("E344: Can't find directory \"%s\" in cdpath")); EXTERN char e_cant_find_file_str_in_path[] @@ -862,7 +861,6 @@ EXTERN char e_no_more_directory_str_found_in_cdpath[] INIT(= N_("E346: No more directory \"%s\" found in cdpath")); EXTERN char e_no_more_file_str_found_in_path[] INIT(= N_("E347: No more file \"%s\" found in path")); -#endif EXTERN char e_no_string_under_cursor[] INIT(= N_("E348: No string under cursor")); EXTERN char e_no_identifier_under_cursor[] @@ -1090,12 +1088,10 @@ EXTERN char e_cannot_close_last_window[] INIT(= N_("E444: Cannot close last window")); EXTERN char e_other_window_contains_changes[] INIT(= N_("E445: Other window contains changes")); -#ifdef FEAT_SEARCHPATH EXTERN char e_no_file_name_under_cursor[] INIT(= N_("E446: No file name under cursor")); EXTERN char e_cant_find_file_str_in_path_2[] INIT(= N_("E447: Can't find file \"%s\" in path")); -#endif #ifdef USING_LOAD_LIBRARY EXTERN char e_could_not_load_library_function_str[] INIT(= N_("E448: Could not load library function %s")); diff --git a/src/evalfunc.c b/src/evalfunc.c index c199bdbe02..3c26453f02 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -5646,13 +5646,7 @@ f_has(typval_T *argvars, typval_T *rettv) 0 #endif }, - {"file_in_path", -#ifdef FEAT_SEARCHPATH - 1 -#else - 0 -#endif - }, + {"file_in_path", 1}, {"filterpipe", #if defined(FEAT_FILTERPIPE) && !defined(VIMDLL) 1 diff --git a/src/ex_docmd.c b/src/ex_docmd.c index b9ff423b64..89c9d26b0f 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -6678,9 +6678,7 @@ ex_wrongmodifier(exarg_T *eap) ex_splitview(exarg_T *eap) { win_T *old_curwin = curwin; -#if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE) char_u *fname = NULL; -#endif #ifdef FEAT_BROWSE char_u dot_path[] = "."; int save_cmod_flags = cmdmod.cmod_flags; @@ -6708,7 +6706,6 @@ ex_splitview(exarg_T *eap) } #endif -#ifdef FEAT_SEARCHPATH if (eap->cmdidx == CMD_sfind || eap->cmdidx == CMD_tabfind) { fname = find_file_in_path(eap->arg, (int)STRLEN(eap->arg), @@ -6718,11 +6715,7 @@ ex_splitview(exarg_T *eap) eap->arg = fname; } # ifdef FEAT_BROWSE - else -# endif -#endif -#ifdef FEAT_BROWSE - if ((cmdmod.cmod_flags & CMOD_BROWSE) + else if ((cmdmod.cmod_flags & CMOD_BROWSE) && eap->cmdidx != CMD_vnew && eap->cmdidx != CMD_new) { @@ -6786,10 +6779,8 @@ ex_splitview(exarg_T *eap) cmdmod.cmod_flags = save_cmod_flags; # endif -# if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE) theend: vim_free(fname); -# endif } /* @@ -6980,7 +6971,6 @@ ex_resize(exarg_T *eap) static void ex_find(exarg_T *eap) { -#ifdef FEAT_SEARCHPATH char_u *fname; int count; @@ -7002,12 +6992,9 @@ ex_find(exarg_T *eap) if (fname != NULL) { eap->arg = fname; -#endif do_exedit(eap, NULL); -#ifdef FEAT_SEARCHPATH vim_free(fname); } -#endif } /* @@ -9273,7 +9260,6 @@ eval_vars( } break; -#ifdef FEAT_SEARCHPATH case SPEC_CFILE: // file name under cursor result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL); if (result == NULL) @@ -9283,7 +9269,6 @@ eval_vars( } resultbuf = result; // remember allocated string break; -#endif case SPEC_AFILE: // file name for autocommand result = autocmd_fname; diff --git a/src/feature.h b/src/feature.h index d594171ad1..9c094e5aad 100644 --- a/src/feature.h +++ b/src/feature.h @@ -97,6 +97,7 @@ * These features used to be optional but are now always enabled: * +windows Multiple windows. Without this there is no help * window and no status lines. + * +autocmd Automatic commands * +vertsplit Vertically split windows. * +cmdhist Command line history. * +localmap Mappings and abbreviations local to a buffer. @@ -115,6 +116,7 @@ * +cindent C code indenting (From Eric Fischer). * +smartindent smart C code indenting when the 'si' option is set. * +textobjects Text objects: "vaw", "das", etc. + * +file_in_path "gf" and "" commands. * * Obsolete: * +tag_old_static Old style static tags: "file:tag file ..". @@ -201,20 +203,11 @@ # define FEAT_QUICKFIX #endif -/* - * +file_in_path "gf" and "" commands. - */ -#ifdef FEAT_NORMAL -# define FEAT_SEARCHPATH -#endif - /* * +find_in_path "[I" ":isearch" "^W^I", ":checkpath", etc. */ #ifdef FEAT_NORMAL -# ifdef FEAT_SEARCHPATH // FEAT_SEARCHPATH is required -# define FEAT_FIND_ID -# endif +# define FEAT_FIND_ID #endif /* @@ -324,7 +317,6 @@ /* * +diff Displaying diffs in a nice way. - * Requires +windows and +autocmd. * Can be enabled in autoconf already. */ #if defined(FEAT_NORMAL) && !defined(FEAT_DIFF) @@ -380,14 +372,14 @@ /* * +syntax syntax highlighting. When using this, it's a good - * idea to have +autocmd and +eval too. + * idea to have +eval too. */ #if defined(FEAT_NORMAL) || defined(PROTO) # define FEAT_SYN_HL #endif /* - * +conceal 'conceal' option. Needs syntax highlighting + * +conceal 'conceal' option. Depends on syntax highlighting * as this is how the concealed text is defined. */ #if defined(FEAT_BIG) && defined(FEAT_SYN_HL) diff --git a/src/filepath.c b/src/filepath.c index ecee8db8b1..f61603fa6f 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -942,7 +942,6 @@ findfilendir( typval_T *rettv, int find_what UNUSED) { -#ifdef FEAT_SEARCHPATH char_u *fname; char_u *fresult = NULL; char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; @@ -951,7 +950,6 @@ findfilendir( int count = 1; int first = TRUE; int error = FALSE; -#endif rettv->vval.v_string = NULL; rettv->v_type = VAR_STRING; @@ -962,7 +960,6 @@ findfilendir( && check_for_opt_number_arg(argvars, 2) == FAIL))) return; -#ifdef FEAT_SEARCHPATH fname = tv_get_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) @@ -1006,7 +1003,6 @@ findfilendir( if (rettv->v_type == VAR_STRING) rettv->vval.v_string = fresult; -#endif } /* @@ -3879,9 +3875,7 @@ gen_expand_wildcards( static int recursive = FALSE; int add_pat; int retval = OK; -#if defined(FEAT_SEARCHPATH) int did_expand_in_path = FALSE; -#endif /* * expand_env() is called to expand things like "~user". If this fails, @@ -3971,7 +3965,6 @@ gen_expand_wildcards( */ if (mch_has_exp_wildcard(p) || (flags & EW_ICASE)) { -#if defined(FEAT_SEARCHPATH) if ((flags & EW_PATH) && !mch_isFullName(p) && !(p[0] == '.' @@ -3987,7 +3980,6 @@ gen_expand_wildcards( did_expand_in_path = TRUE; } else -#endif add_pat = mch_expandpath(&ga, p, flags); } } @@ -4007,10 +3999,8 @@ gen_expand_wildcards( vim_free(t); } -#if defined(FEAT_SEARCHPATH) if (did_expand_in_path && ga.ga_len > 0 && (flags & EW_PATH)) uniquefy_paths(&ga, p); -#endif if (p != pat[i]) vim_free(p); } diff --git a/src/findfile.c b/src/findfile.c index 881eef156e..8267be6e09 100644 --- a/src/findfile.c +++ b/src/findfile.c @@ -709,14 +709,10 @@ vim_findfile(void *search_ctx_arg) char_u *path_end = NULL; #endif ff_stack_T *stackp; -#if defined(FEAT_SEARCHPATH) || defined(FEAT_PATH_EXTRA) int len; -#endif int i; char_u *p; -#ifdef FEAT_SEARCHPATH char_u *suf; -#endif ff_search_ctx_T *search_ctx; if (search_ctx_arg == NULL) @@ -995,14 +991,12 @@ vim_findfile(void *search_ctx_arg) * Try without extra suffix and then with suffixes * from 'suffixesadd'. */ -#ifdef FEAT_SEARCHPATH len = (int)STRLEN(file_path); if (search_ctx->ffsc_tagfile) suf = (char_u *)""; else suf = curbuf->b_p_sua; for (;;) -#endif { // if file exists and we didn't already find it if ((path_with_url(file_path) @@ -1072,13 +1066,11 @@ vim_findfile(void *search_ctx_arg) return file_path; } -#ifdef FEAT_SEARCHPATH // Not found or found already, try next suffix. if (*suf == NUL) break; copy_option_part(&suf, file_path + len, MAXPATHL - len, ","); -#endif } } } @@ -1633,7 +1625,6 @@ ff_path_in_stoplist(char_u *path, int path_len, char_u **stopdirs_v) } #endif -#if defined(FEAT_SEARCHPATH) || defined(PROTO) /* * Find the file name "ptr[len]" in the path. Also finds directory names. * @@ -2636,7 +2627,6 @@ expand_in_path( return gap->ga_len; } -#endif // FEAT_SEARCHPATH /* * Converts a file name into a canonical form. It simplifies a file name into diff --git a/src/misc2.c b/src/misc2.c index 38dcb48d17..84adafab66 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -2399,15 +2399,12 @@ update_mouseshape(int shape_idx) /* - * Change directory to "new_dir". If FEAT_SEARCHPATH is defined, search - * 'cdpath' for relative directory names, otherwise just mch_chdir(). + * Change directory to "new_dir". Search 'cdpath' for relative directory + * names, otherwise just mch_chdir(). */ int vim_chdir(char_u *new_dir) { -#ifndef FEAT_SEARCHPATH - return mch_chdir((char *)new_dir); -#else char_u *dir_name; int r; @@ -2418,7 +2415,6 @@ vim_chdir(char_u *new_dir) r = mch_chdir((char *)dir_name); vim_free(dir_name); return r; -#endif } /* diff --git a/src/normal.c b/src/normal.c index 0ce0d4e32e..6fcdaeb78e 100644 --- a/src/normal.c +++ b/src/normal.c @@ -4049,7 +4049,6 @@ nv_down(cmdarg_T *cap) } } -#ifdef FEAT_SEARCHPATH /* * Grab the file name under the cursor and edit it. */ @@ -4092,7 +4091,6 @@ nv_gotofile(cmdarg_T *cap) else clearop(cap->oap); } -#endif /* * command: to end of current line or last line. @@ -4439,12 +4437,10 @@ nv_brackets(cmdarg_T *cap) old_pos = curwin->w_cursor; curwin->w_cursor.coladd = 0; // TODO: don't do this for an error. -#ifdef FEAT_SEARCHPATH // "[f" or "]f" : Edit file under the cursor (same as "gf") if (cap->nchar == 'f') nv_gotofile(cap); else -#endif #ifdef FEAT_FIND_ID // Find the occurrence(s) of the identifier or define under cursor @@ -6079,14 +6075,12 @@ nv_g_cmd(cmdarg_T *cap) invoke_edit(cap, FALSE, 'g', FALSE); break; -#ifdef FEAT_SEARCHPATH // "gf": goto file, edit file under cursor // "]f" and "[f": can also be used. case 'f': case 'F': nv_gotofile(cap); break; -#endif // "g'm" and "g`m": jump to mark without setting pcmark case '\'': diff --git a/src/option.c b/src/option.c index f3c53b2282..05e0527cd3 100644 --- a/src/option.c +++ b/src/option.c @@ -220,7 +220,6 @@ set_init_1(int clean_arg) } } -#ifdef FEAT_SEARCHPATH { char_u *cdpath; char_u *buf; @@ -262,7 +261,6 @@ set_init_1(int clean_arg) vim_free(cdpath); } } -#endif #if defined(FEAT_POSTSCRIPT) && \ (defined(MSWIN) || defined(VMS) || defined(MAC) || defined(hpux)) @@ -5519,9 +5517,7 @@ get_varp(struct vimoption *p) case PV_SI: return (char_u *)&(curbuf->b_p_si); case PV_SN: return (char_u *)&(curbuf->b_p_sn); case PV_STS: return (char_u *)&(curbuf->b_p_sts); -#ifdef FEAT_SEARCHPATH case PV_SUA: return (char_u *)&(curbuf->b_p_sua); -#endif case PV_SWF: return (char_u *)&(curbuf->b_p_swf); #ifdef FEAT_SYN_HL case PV_SMC: return (char_u *)&(curbuf->b_p_smc); @@ -6080,10 +6076,8 @@ buf_copy_options(buf_T *buf, int flags) buf->b_p_key = vim_strsave(p_key); COPY_OPT_SCTX(buf, BV_KEY); #endif -#ifdef FEAT_SEARCHPATH buf->b_p_sua = vim_strsave(p_sua); COPY_OPT_SCTX(buf, BV_SUA); -#endif #ifdef FEAT_KEYMAP buf->b_p_keymap = vim_strsave(p_keymap); COPY_OPT_SCTX(buf, BV_KMAP); @@ -6380,20 +6374,14 @@ set_context_in_set_cmd( || p == (char_u *)&p_path || p == (char_u *)&p_pp || p == (char_u *)&p_rtp -#ifdef FEAT_SEARCHPATH || p == (char_u *)&p_cdpath -#endif #ifdef FEAT_SESSION || p == (char_u *)&p_vdir #endif ) { xp->xp_context = EXPAND_DIRECTORIES; - if (p == (char_u *)&p_path -#ifdef FEAT_SEARCHPATH - || p == (char_u *)&p_cdpath -#endif - ) + if (p == (char_u *)&p_path || p == (char_u *)&p_cdpath) xp->xp_backslash = XP_BS_THREE; else xp->xp_backslash = XP_BS_ONE; diff --git a/src/option.h b/src/option.h index 4d9f7e2327..d40dcb5ea5 100644 --- a/src/option.h +++ b/src/option.h @@ -780,9 +780,7 @@ EXTERN char_u *p_pex; // 'patchexpr' #endif EXTERN char_u *p_pm; // 'patchmode' EXTERN char_u *p_path; // 'path' -#ifdef FEAT_SEARCHPATH EXTERN char_u *p_cdpath; // 'cdpath' -#endif #if defined(DYNAMIC_PERL) EXTERN char_u *p_perldll; // 'perldll' #endif @@ -908,9 +906,7 @@ EXTERN int p_si; // 'smartindent' EXTERN int p_sta; // 'smarttab' EXTERN long p_sts; // 'softtabstop' EXTERN int p_sb; // 'splitbelow' -#if defined(FEAT_SEARCHPATH) EXTERN char_u *p_sua; // 'suffixesadd' -#endif EXTERN int p_swf; // 'swapfile' #ifdef FEAT_SYN_HL EXTERN long p_smc; // 'synmaxcol' @@ -1196,9 +1192,7 @@ enum , BV_SPO #endif , BV_STS -#ifdef FEAT_SEARCHPATH , BV_SUA -#endif , BV_SW , BV_SWF #ifdef FEAT_EVAL diff --git a/src/optiondefs.h b/src/optiondefs.h index be9a86e44e..de63ceb4ab 100644 --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -123,9 +123,7 @@ # define PV_SPO OPT_BUF(BV_SPO) #endif #define PV_STS OPT_BUF(BV_STS) -#ifdef FEAT_SEARCHPATH -# define PV_SUA OPT_BUF(BV_SUA) -#endif +#define PV_SUA OPT_BUF(BV_SUA) #define PV_SW OPT_BUF(BV_SW) #define PV_SWF OPT_BUF(BV_SWF) #ifdef FEAT_EVAL @@ -546,13 +544,8 @@ static struct vimoption options[] = {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE|P_COMMA|P_NODUP, -#ifdef FEAT_SEARCHPATH (char_u *)&p_cdpath, PV_NONE, {(char_u *)",,", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCTX_INIT}, {"cedit", NULL, P_STRING, #ifdef FEAT_CMDWIN @@ -2380,13 +2373,8 @@ static struct vimoption options[] = {(char_u *)".bak,~,.o,.h,.info,.swp,.obj", (char_u *)0L} SCTX_INIT}, {"suffixesadd", "sua", P_STRING|P_VI_DEF|P_ALLOCED|P_ONECOMMA|P_NODUP, -#ifdef FEAT_SEARCHPATH (char_u *)&p_sua, PV_SUA, {(char_u *)"", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCTX_INIT}, {"swapfile", "swf", P_BOOL|P_VI_DEF|P_RSTAT, (char_u *)&p_swf, PV_SWF, diff --git a/src/optionstr.c b/src/optionstr.c index 4fbfcc9b1d..13302efbdc 100644 --- a/src/optionstr.c +++ b/src/optionstr.c @@ -253,9 +253,7 @@ check_buf_options(buf_T *buf) check_string_option(&buf->b_s.b_p_spl); check_string_option(&buf->b_s.b_p_spo); #endif -#ifdef FEAT_SEARCHPATH check_string_option(&buf->b_p_sua); -#endif check_string_option(&buf->b_p_cink); check_string_option(&buf->b_p_cino); check_string_option(&buf->b_p_cinsd); diff --git a/src/register.c b/src/register.c index 22b79abb85..6a9cb1e02f 100644 --- a/src/register.c +++ b/src/register.c @@ -914,7 +914,6 @@ get_spec_reg( emsg(_(e_no_inserted_text_yet)); return TRUE; -#ifdef FEAT_SEARCHPATH case Ctrl_F: // Filename under cursor case Ctrl_P: // Path under cursor, expand via "path" if (!errmsg) @@ -923,7 +922,6 @@ get_spec_reg( | (regname == Ctrl_P ? FNAME_EXP : 0), 1L, NULL); *allocated = TRUE; return TRUE; -#endif case Ctrl_W: // word under cursor case Ctrl_A: // WORD (mnemonic All) under cursor @@ -2586,10 +2584,8 @@ get_reg_type(int regname, long *reglen) case ':': // last command line case '/': // last search-pattern case '.': // last inserted text -# ifdef FEAT_SEARCHPATH case Ctrl_F: // Filename under cursor case Ctrl_P: // Path under cursor, expand via "path" -# endif case Ctrl_W: // word under cursor case Ctrl_A: // WORD (mnemonic All) under cursor case '_': // black hole: always empty diff --git a/src/structs.h b/src/structs.h index a507a37c5e..28cfa00ffc 100644 --- a/src/structs.h +++ b/src/structs.h @@ -2973,9 +2973,7 @@ struct file_buffer int b_p_si; // 'smartindent' long b_p_sts; // 'softtabstop' long b_p_sts_nopaste; // b_p_sts saved for paste mode -#ifdef FEAT_SEARCHPATH char_u *b_p_sua; // 'suffixesadd' -#endif int b_p_swf; // 'swapfile' #ifdef FEAT_SYN_HL long b_p_smc; // 'synmaxcol' diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim index e303212793..56629d91bd 100644 --- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -949,7 +949,6 @@ endfunc " Test for the default CDPATH option func Test_opt_default_cdpath() - CheckFeature file_in_path let after =<< trim [CODE] call assert_equal(',/path/to/dir1,/path/to/dir2', &cdpath) call writefile(v:errors, 'Xtestout') diff --git a/src/version.c b/src/version.c index c17f7f866c..ac14bbd855 100644 --- a/src/version.c +++ b/src/version.c @@ -246,11 +246,7 @@ static char *(features[]) = "-extra_search", #endif "-farsi", -#ifdef FEAT_SEARCHPATH "+file_in_path", -#else - "-file_in_path", -#endif #ifdef FEAT_FIND_ID "+find_in_path", #else @@ -731,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 265, /**/ 264, /**/ diff --git a/src/window.c b/src/window.c index 3ee65fbf4a..8c42b6064a 100644 --- a/src/window.c +++ b/src/window.c @@ -136,10 +136,8 @@ do_window( { long Prenum1; win_T *wp; -#if defined(FEAT_SEARCHPATH) || defined(FEAT_FIND_ID) char_u *ptr; linenr_T lnum = -1; -#endif #ifdef FEAT_FIND_ID int type = FIND_DEFINE; int len; @@ -521,7 +519,6 @@ newwindow: do_nv_ident(Ctrl_RSB, NUL); break; -#ifdef FEAT_SEARCHPATH // edit file name under cursor in a new window case 'f': case 'F': @@ -534,9 +531,9 @@ wingotofile: { tabpage_T *oldtab = curtab; win_T *oldwin = curwin; -# ifdef FEAT_GUI +#ifdef FEAT_GUI need_mouse_correct = TRUE; -# endif +#endif setpcmark(); if (win_split(0, 0) == OK) { @@ -559,7 +556,6 @@ wingotofile: vim_free(ptr); } break; -#endif #ifdef FEAT_FIND_ID // Go to the first occurrence of the identifier under cursor along path in a @@ -637,13 +633,12 @@ wingotofile: do_nv_ident('g', xchar); break; -#ifdef FEAT_SEARCHPATH case 'f': // CTRL-W gf: "gf" in a new tab page case 'F': // CTRL-W gF: "gF" in a new tab page cmdmod.cmod_tab = tabpage_index(curtab) + 1; nchar = xchar; goto wingotofile; -#endif + case 't': // CTRL-W gt: go to next tab page goto_tabpage((int)Prenum); break; @@ -713,11 +708,9 @@ get_wincmd_addr_type(char_u *arg, exarg_T *eap) #if defined(FEAT_QUICKFIX) case '}': #endif -#ifdef FEAT_SEARCHPATH case 'f': case 'F': case Ctrl_F: -#endif #ifdef FEAT_FIND_ID case 'i': case Ctrl_I: From 340dafd155222ac96304107542344faf3c56e12b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 25 Aug 2022 16:16:45 +0100 Subject: [PATCH 06/10] patch 9.0.0266: compiler warning for unused argument Problem: Compiler warning for unused argument. Solution: Add UNUSED. --- src/buffer.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index cec2abbb2c..7286852812 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5651,7 +5651,7 @@ bt_normal(buf_T *buf) * Return TRUE if "buf" is the quickfix buffer. */ int -bt_quickfix(buf_T *buf) +bt_quickfix(buf_T *buf UNUSED) { #ifdef FEAT_QUICKFIX return buf != NULL && buf->b_p_bt[0] == 'q'; @@ -5664,7 +5664,7 @@ bt_quickfix(buf_T *buf) * Return TRUE if "buf" is a terminal buffer. */ int -bt_terminal(buf_T *buf) +bt_terminal(buf_T *buf UNUSED) { #if defined(FEAT_TERMINAL) return buf != NULL && buf->b_p_bt[0] == 't'; diff --git a/src/version.c b/src/version.c index ac14bbd855..50294f8523 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 266, /**/ 265, /**/ From 930830a68b6eb7ca630956330b48996e3ef8518f Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:24:56 +0100 Subject: [PATCH 07/10] patch 9.0.0267: Coverity workflow still uses Ubuntu 18.04 Problem: Coverity workflow still uses Ubuntu 18.04. Solution: Use Ubuntu 20.04 --- .github/workflows/coverity.yml | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index a58a20b615..566ab5b2fe 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -6,7 +6,7 @@ on: jobs: scan: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 env: CC: gcc diff --git a/src/version.c b/src/version.c index 50294f8523..b5cdfdf789 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 267, /**/ 266, /**/ From 0166e398d11a09662d783fe5db62b414045880f8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 25 Aug 2022 16:30:01 +0100 Subject: [PATCH 08/10] patch 9.0.0268: build error without the +eval feature Problem: Build error without the +eval feature. Solution: Remove #ifdef. --- src/globals.h | 2 -- src/version.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals.h b/src/globals.h index 3c2d904666..0af3ce7367 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1605,9 +1605,7 @@ EXTERN int netbeansSuppressNoLines INIT(= 0); // skip "No lines in buffer" EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM")); EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP")); -#ifdef FEAT_EVAL EXTERN char line_msg[] INIT(= N_(" line ")); -#endif #ifdef FEAT_CRYPT EXTERN char need_key_msg[] INIT(= N_("Need encryption key for \"%s\"")); diff --git a/src/version.c b/src/version.c index b5cdfdf789..022b7199c5 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 268, /**/ 267, /**/ From 520f6ef60a59f7b5f3da9199999d13dbe817d3ce Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Thu, 25 Aug 2022 17:40:40 +0100 Subject: [PATCH 09/10] patch 9.0.0269: getscriptinfo() does not include the version Problem: getscriptinfo() does not include the version. Cannot select entries by script name. Solution: Add the "version" item and the "name" argument. (Yegappan Lakshmanan, closes #10962) --- runtime/doc/builtin.txt | 11 +++++++++-- src/evalfunc.c | 2 +- src/scriptfile.c | 28 +++++++++++++++++++++++++++- src/testdir/test_scriptnames.vim | 30 ++++++++++++++++++++++++++---- src/testdir/test_vim9_builtin.vim | 4 ++++ src/testdir/test_vim9_import.vim | 9 +++++++-- src/version.c | 2 ++ 7 files changed, 76 insertions(+), 10 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 49d538d1e7..15af01fbbf 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -253,7 +253,7 @@ getreg([{regname} [, 1 [, {list}]]]) String or List contents of a register getreginfo([{regname}]) Dict information about a register getregtype([{regname}]) String type of a register -getscriptinfo() List list of sourced scripts +getscriptinfo([{opts}]) List list of sourced scripts gettabinfo([{expr}]) List list of tab pages gettabvar({nr}, {varname} [, {def}]) any variable {varname} in tab {nr} or {def} @@ -4089,7 +4089,7 @@ getregtype([{regname}]) *getregtype()* Can also be used as a |method|: > GetRegname()->getregtype() -getscriptinfo() *getscriptinfo()* +getscriptinfo([{opts}) *getscriptinfo()* Returns a |List| with information about all the sourced Vim scripts in the order they were sourced, like what `:scriptnames` shows. @@ -4104,6 +4104,13 @@ getscriptinfo() *getscriptinfo()* sourced script ID of the actually sourced script that this script name links to, if any, otherwise zero + version vimscript version (|scriptversion|) + + The optional Dict argument {opts} supports the following + items: + name script name match pattern. If specified, + information about scripts with name + that match the pattern "name" are returned. gettabinfo([{tabnr}]) *gettabinfo()* If {tabnr} is not specified, then information about all the diff --git a/src/evalfunc.c b/src/evalfunc.c index 3c26453f02..6502b58b23 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1935,7 +1935,7 @@ static funcentry_T global_functions[] = ret_dict_any, f_getreginfo}, {"getregtype", 0, 1, FEARG_1, arg1_string, ret_string, f_getregtype}, - {"getscriptinfo", 0, 0, 0, NULL, + {"getscriptinfo", 0, 1, 0, arg1_dict_any, ret_list_dict_any, f_getscriptinfo}, {"gettabinfo", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, f_gettabinfo}, diff --git a/src/scriptfile.c b/src/scriptfile.c index 1382f29d76..a2b88a65aa 100644 --- a/src/scriptfile.c +++ b/src/scriptfile.c @@ -1946,17 +1946,35 @@ get_sourced_lnum( : SOURCING_LNUM; } +/* + * getscriptinfo() function + */ void -f_getscriptinfo(typval_T *argvars UNUSED, typval_T *rettv) +f_getscriptinfo(typval_T *argvars, typval_T *rettv) { int i; list_T *l; + char_u *pat = NULL; + regmatch_T regmatch; if (rettv_list_alloc(rettv) == FAIL) return; + if (check_for_opt_dict_arg(argvars, 0) == FAIL) + return; + l = rettv->vval.v_list; + regmatch.regprog = NULL; + regmatch.rm_ic = p_ic; + + if (argvars[0].v_type == VAR_DICT) + { + pat = dict_get_string(argvars[0].vval.v_dict, "name", TRUE); + if (pat != NULL) + regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + } + for (i = 1; i <= script_items.ga_len; ++i) { scriptitem_T *si = SCRIPT_ITEM(i); @@ -1965,15 +1983,23 @@ f_getscriptinfo(typval_T *argvars UNUSED, typval_T *rettv) if (si->sn_name == NULL) continue; + if (pat != NULL && regmatch.regprog != NULL + && !vim_regexec(®match, si->sn_name, (colnr_T)0)) + continue; + if ((d = dict_alloc()) == NULL || list_append_dict(l, d) == FAIL || dict_add_string(d, "name", si->sn_name) == FAIL || dict_add_number(d, "sid", i) == FAIL || dict_add_number(d, "sourced", si->sn_sourced_sid) == FAIL + || dict_add_number(d, "version", si->sn_version) == FAIL || dict_add_bool(d, "autoload", si->sn_state == SN_STATE_NOT_LOADED) == FAIL) return; } + + vim_regfree(regmatch.regprog); + vim_free(pat); } #endif diff --git a/src/testdir/test_scriptnames.vim b/src/testdir/test_scriptnames.vim index 06ae305ab7..2d8ee61867 100644 --- a/src/testdir/test_scriptnames.vim +++ b/src/testdir/test_scriptnames.vim @@ -31,12 +31,34 @@ endfunc " Test for the getscriptinfo() function func Test_getscriptinfo() - call writefile(['let loaded_script_id = expand("")'], 'Xscript') - source Xscript + let lines =<< trim END + let g:loaded_script_id = expand("") + let s:XscriptVar = [1, #{v: 2}] + func s:XscriptFunc() + endfunc + END + call writefile(lines, 'X22script91') + source X22script91 let l = getscriptinfo() - call assert_match('Xscript$', l[-1].name) + call assert_match('X22script91$', l[-1].name) call assert_equal(g:loaded_script_id, $"{l[-1].sid}_") - call delete('Xscript') + + let l = getscriptinfo({'name': '22script91'}) + call assert_equal(1, len(l)) + call assert_match('22script91$', l[0].name) + + let l = getscriptinfo({'name': 'foobar'}) + call assert_equal(0, len(l)) + let l = getscriptinfo({'name': ''}) + call assert_true(len(l) > 1) + + call assert_fails("echo getscriptinfo({'name': []})", 'E730:') + call assert_fails("echo getscriptinfo({'name': '\\@'})", 'E866:') + let l = getscriptinfo({'name': test_null_string()}) + call assert_true(len(l) > 1) + call assert_fails("echo getscriptinfo('foobar')", 'E1206:') + + call delete('X22script91') endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 7aa81bc225..931fe671c9 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -1896,6 +1896,10 @@ def Test_getregtype() getregtype('')->assert_equal("\4") enddef +def Test_getscriptinfo() + v9.CheckDefAndScriptFailure(['getscriptinfo("x")'], ['E1013: Argument 1: type mismatch, expected dict but got string', 'E1206: Dictionary required for argument 1']) +enddef + def Test_gettabinfo() v9.CheckDefAndScriptFailure(['gettabinfo("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1']) enddef diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim index d9b40d6970..832fad8d74 100644 --- a/src/testdir/test_vim9_import.vim +++ b/src/testdir/test_vim9_import.vim @@ -732,10 +732,15 @@ def Test_use_relative_autoload_import_in_mapping() source Xmapscript.vim assert_match('\d\+ A: .*XrelautoloadExport.vim', execute('scriptnames')->split("\n")[-1]) - assert_match('XrelautoloadExport.vim$', getscriptinfo()[-1].name) - assert_true(getscriptinfo()[-1].autoload) + var l = getscriptinfo() + assert_match('XrelautoloadExport.vim$', l[-1].name) + assert_true(l[-1].autoload) feedkeys("\", "xt") assert_equal(42, g:result) + l = getscriptinfo({name: 'XrelautoloadExport'}) + assert_true(len(l) == 1) + assert_match('XrelautoloadExport.vim$', l[0].name) + assert_false(l[0].autoload) unlet g:result delete('XrelautoloadExport.vim') diff --git a/src/version.c b/src/version.c index 022b7199c5..b794c0c886 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 269, /**/ 268, /**/ From 2bd9dbc19fc67395cfa1226dda7326071ab22464 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 25 Aug 2022 18:12:06 +0100 Subject: [PATCH 10/10] patch 9.0.0270: some values of 'path' and 'tags' invalid in the tiny version Problem: Some values of 'path' and 'tags' do not work in the tiny version. Solution: Graduate the +path_extra feature. --- runtime/doc/editing.txt | 2 - runtime/doc/options.txt | 4 +- runtime/doc/various.txt | 3 +- src/errors.h | 2 - src/evalfunc.c | 8 +-- src/feature.h | 8 +-- src/findfile.c | 113 +++++----------------------------------- src/tag.c | 4 -- src/version.c | 6 +-- 9 files changed, 19 insertions(+), 131 deletions(-) diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 7eaf48d51f..522831f992 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1703,8 +1703,6 @@ problem goes away the next day. ============================================================================== 11. File Searching *file-searching* -{not available when compiled without the |+path_extra| feature} - The file searching is currently used for the 'path', 'cdpath' and 'tags' options, for |finddir()| and |findfile()|. Other commands use |wildcards| which is slightly different. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 1a21be8ba1..e4bf25f70c 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5949,7 +5949,6 @@ A jump table for the options with a short description can be found at |Q_op|. "http://www.vim.org" will make ":find index.html" work. - Search upwards and downwards in a directory tree using "*", "**" and ";". See |file-searching| for info and syntax. - {not available when compiled without the |+path_extra| feature} - Careful with '\' characters, type two to get one in the option: > :set path=.,c:\\include < Or just use '/' instead: > @@ -8001,8 +8000,7 @@ A jump table for the options with a short description can be found at |Q_op|. a directory tree. See |file-searching|. E.g., "/lib/**/tags" will find all files named "tags" below "/lib". The filename itself cannot contain wildcards, it is used as-is. E.g., "/lib/**/tags?" will find - files called "tags?". {not available when compiled without the - |+path_extra| feature} + files called "tags?". The |tagfiles()| function can be used to get a list of the file names actually used. If Vim was compiled with the |+emacs_tags| feature, Emacs-style tag diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 62a9b203a4..92403d376c 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -432,7 +432,8 @@ T *+num64* 64-bit Number support |Number| check the actual size of a Number. m *+ole* Win32 GUI only: |ole-interface| N *+packages* Loading |packages| -N *+path_extra* Up/downwards search in 'path' and 'tags' +T *+path_extra* Up/downwards search in 'path' and 'tags' Always + enabled since 9.0.0270 m *+perl* Perl interface |perl| m *+perl/dyn* Perl interface |perl-dynamic| |/dyn| N *+persistent_undo* Persistent undo |undo-persistence| diff --git a/src/errors.h b/src/errors.h index b903ae7d2c..9d987c9e39 100644 --- a/src/errors.h +++ b/src/errors.h @@ -849,10 +849,8 @@ EXTERN char e_internal_error_lalloc_zero[] INIT(= N_("E341: Internal error: lalloc(0, )")); EXTERN char e_out_of_memory_allocating_nr_bytes[] INIT(= N_("E342: Out of memory! (allocating %lu bytes)")); -#ifdef FEAT_PATH_EXTRA EXTERN char e_invalid_path_number_must_be_at_end_of_path_or_be_followed_by_str[] INIT(= N_("E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'.")); -#endif EXTERN char e_cant_find_directory_str_in_cdpath[] INIT(= N_("E344: Can't find directory \"%s\" in cdpath")); EXTERN char e_cant_find_file_str_in_path[] diff --git a/src/evalfunc.c b/src/evalfunc.c index 6502b58b23..b3084f3358 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -5954,13 +5954,7 @@ f_has(typval_T *argvars, typval_T *rettv) 0 #endif }, - {"path_extra", -#ifdef FEAT_PATH_EXTRA - 1 -#else - 0 -#endif - }, + {"path_extra", 1}, {"perl", #if defined(FEAT_PERL) && !defined(DYNAMIC_PERL) 1 diff --git a/src/feature.h b/src/feature.h index 9c094e5aad..bffd80a919 100644 --- a/src/feature.h +++ b/src/feature.h @@ -117,6 +117,7 @@ * +smartindent smart C code indenting when the 'si' option is set. * +textobjects Text objects: "vaw", "das", etc. * +file_in_path "gf" and "" commands. + * +path_extra up/downwards searching in 'path' and 'tags'. * * Obsolete: * +tag_old_static Old style static tags: "file:tag file ..". @@ -210,13 +211,6 @@ # define FEAT_FIND_ID #endif -/* - * +path_extra up/downwards searching in 'path' and 'tags'. - */ -#ifdef FEAT_NORMAL -# define FEAT_PATH_EXTRA -#endif - /* * +rightleft Right-to-left editing/typing support. */ diff --git a/src/findfile.c b/src/findfile.c index 8267be6e09..c3089274b2 100644 --- a/src/findfile.c +++ b/src/findfile.c @@ -67,9 +67,7 @@ typedef struct ff_stack // the fix part (no wildcards) and the part containing the wildcards // of the search path char_u *ffs_fix_path; -#ifdef FEAT_PATH_EXTRA char_u *ffs_wc_path; -#endif // files/dirs found in the above directory, matched by the first wildcard // of wc_part @@ -97,11 +95,10 @@ typedef struct ff_visited { struct ff_visited *ffv_next; -#ifdef FEAT_PATH_EXTRA // Visited directories are different if the wildcard string are // different. So we have to save it. char_u *ffv_wc_path; -#endif + // for unix use inode etc for comparison (needed because of links), else // use filename. #ifdef UNIX @@ -173,21 +170,15 @@ typedef struct ff_search_ctx_T char_u *ffsc_file_to_search; char_u *ffsc_start_dir; char_u *ffsc_fix_path; -#ifdef FEAT_PATH_EXTRA char_u *ffsc_wc_path; int ffsc_level; char_u **ffsc_stopdirs_v; -#endif int ffsc_find_what; int ffsc_tagfile; } ff_search_ctx_T; // locally needed functions -#ifdef FEAT_PATH_EXTRA static int ff_check_visited(ff_visited_T **, char_u *, char_u *); -#else -static int ff_check_visited(ff_visited_T **, char_u *); -#endif static void vim_findfile_free_visited(void *search_ctx_arg); static void vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp); static void ff_free_visited_list(ff_visited_T *vl); @@ -197,14 +188,8 @@ static void ff_push(ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr); static ff_stack_T *ff_pop(ff_search_ctx_T *search_ctx); static void ff_clear(ff_search_ctx_T *search_ctx); static void ff_free_stack_element(ff_stack_T *stack_ptr); -#ifdef FEAT_PATH_EXTRA static ff_stack_T *ff_create_stack_element(char_u *, char_u *, int, int); -#else -static ff_stack_T *ff_create_stack_element(char_u *, int, int); -#endif -#ifdef FEAT_PATH_EXTRA static int ff_path_in_stoplist(char_u *, int, char_u **); -#endif static char_u *ff_expand_buffer = NULL; // used for expanding filenames @@ -306,9 +291,7 @@ vim_findfile_init( int tagfile, // expanding names of tags files char_u *rel_fname) // file name to use for "." { -#ifdef FEAT_PATH_EXTRA char_u *wc_part; -#endif ff_stack_T *sptr; ff_search_ctx_T *search_ctx; @@ -409,7 +392,6 @@ vim_findfile_init( #endif } -#ifdef FEAT_PATH_EXTRA /* * If stopdirs are given, split them into an array of pointers. * If this fails (mem allocation), there is no upward search at all or a @@ -464,9 +446,7 @@ vim_findfile_init( search_ctx->ffsc_stopdirs_v[dircount-1] = NULL; } } -#endif -#ifdef FEAT_PATH_EXTRA search_ctx->ffsc_level = level; /* @@ -531,7 +511,6 @@ vim_findfile_init( goto error_return; } else -#endif search_ctx->ffsc_fix_path = vim_strsave(path); if (search_ctx->ffsc_start_dir == NULL) @@ -565,7 +544,6 @@ vim_findfile_init( STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path); add_pathsep(ff_expand_buffer); } -#ifdef FEAT_PATH_EXTRA else { char_u *p = gettail(search_ctx->ffsc_fix_path); @@ -612,15 +590,11 @@ vim_findfile_init( search_ctx->ffsc_wc_path = temp; } } -#endif vim_free(buf); } sptr = ff_create_stack_element(ff_expand_buffer, -#ifdef FEAT_PATH_EXTRA - search_ctx->ffsc_wc_path, -#endif - level, 0); + search_ctx->ffsc_wc_path, level, 0); if (sptr == NULL) goto error_return; @@ -643,7 +617,6 @@ error_return: return NULL; } -#if defined(FEAT_PATH_EXTRA) || defined(PROTO) /* * Get the stopdir string. Check that ';' is not escaped. */ @@ -672,7 +645,6 @@ vim_findfile_stopdir(char_u *buf) r_ptr = NULL; return r_ptr; } -#endif /* * Clean up the given search context. Can handle a NULL pointer. @@ -704,10 +676,8 @@ vim_findfile_cleanup(void *ctx) vim_findfile(void *search_ctx_arg) { char_u *file_path; -#ifdef FEAT_PATH_EXTRA char_u *rest_of_wildcards; char_u *path_end = NULL; -#endif ff_stack_T *stackp; int len; int i; @@ -727,18 +697,14 @@ vim_findfile(void *search_ctx_arg) if ((file_path = alloc(MAXPATHL)) == NULL) return NULL; -#ifdef FEAT_PATH_EXTRA // store the end of the start dir -- needed for upward search if (search_ctx->ffsc_start_dir != NULL) path_end = &search_ctx->ffsc_start_dir[ STRLEN(search_ctx->ffsc_start_dir)]; -#endif -#ifdef FEAT_PATH_EXTRA // upward search loop for (;;) { -#endif // downward search loop for (;;) { @@ -774,11 +740,7 @@ vim_findfile(void *search_ctx_arg) if (stackp->ffs_filearray == NULL && ff_check_visited(&search_ctx->ffsc_dir_visited_list ->ffvl_visited_list, - stackp->ffs_fix_path -#ifdef FEAT_PATH_EXTRA - , stackp->ffs_wc_path -#endif - ) == FAIL) + stackp->ffs_fix_path, stackp->ffs_wc_path) == FAIL) { #ifdef FF_VERBOSE if (p_verbose >= 5) @@ -859,7 +821,6 @@ vim_findfile(void *search_ctx_arg) goto fail; } -#ifdef FEAT_PATH_EXTRA rest_of_wildcards = stackp->ffs_wc_path; if (*rest_of_wildcards != NUL) { @@ -919,7 +880,6 @@ vim_findfile(void *search_ctx_arg) if (vim_ispathsep(*rest_of_wildcards)) rest_of_wildcards++; } -#endif /* * Expand wildcards like "*" and "$VAR". @@ -947,18 +907,14 @@ vim_findfile(void *search_ctx_arg) stackp->ffs_filearray_cur = 0; stackp->ffs_stage = 0; } -#ifdef FEAT_PATH_EXTRA else rest_of_wildcards = &stackp->ffs_wc_path[ STRLEN(stackp->ffs_wc_path)]; -#endif if (stackp->ffs_stage == 0) { // this is the first time we work on this directory -#ifdef FEAT_PATH_EXTRA if (*rest_of_wildcards == NUL) -#endif { /* * We don't have further wildcards to expand, so we have to @@ -1008,23 +964,17 @@ vim_findfile(void *search_ctx_arg) == mch_isdir(file_path))))) #ifndef FF_VERBOSE && (ff_check_visited( - &search_ctx->ffsc_visited_list->ffvl_visited_list, - file_path -#ifdef FEAT_PATH_EXTRA - , (char_u *)"" -#endif - ) == OK) + &search_ctx->ffsc_visited_list + ->ffvl_visited_list, + file_path, (char_u *)"") == OK) #endif ) { #ifdef FF_VERBOSE if (ff_check_visited( - &search_ctx->ffsc_visited_list->ffvl_visited_list, - file_path -#ifdef FEAT_PATH_EXTRA - , (char_u *)"" -#endif - ) == FAIL) + &search_ctx->ffsc_visited_list + ->ffvl_visited_list, + file_path, (char_u *)"") == FAIL) { if (p_verbose >= 5) { @@ -1074,7 +1024,6 @@ vim_findfile(void *search_ctx_arg) } } } -#ifdef FEAT_PATH_EXTRA else { /* @@ -1094,12 +1043,10 @@ vim_findfile(void *search_ctx_arg) stackp->ffs_level - 1, 0)); } } -#endif stackp->ffs_filearray_cur = 0; stackp->ffs_stage = 1; } -#ifdef FEAT_PATH_EXTRA /* * if wildcards contains '**' we have to descent till we reach the * leaves of the directory tree. @@ -1119,14 +1066,12 @@ vim_findfile(void *search_ctx_arg) stackp->ffs_wc_path, stackp->ffs_level - 1, 1)); } } -#endif // we are done with the current directory ff_free_stack_element(stackp); } -#ifdef FEAT_PATH_EXTRA // If we reached this, we didn't find anything downwards. // Let's check if we should do an upward search. if (search_ctx->ffsc_start_dir @@ -1173,7 +1118,6 @@ vim_findfile(void *search_ctx_arg) else break; } -#endif fail: vim_free(file_path); @@ -1222,9 +1166,7 @@ ff_free_visited_list(ff_visited_T *vl) while (vl != NULL) { vp = vl->ffv_next; -#ifdef FEAT_PATH_EXTRA vim_free(vl->ffv_wc_path); -#endif vim_free(vl); vl = vp; } @@ -1298,7 +1240,6 @@ ff_get_visited_list( return retptr; } -#ifdef FEAT_PATH_EXTRA /* * check if two wildcard paths are equal. Returns TRUE or FALSE. * They are equal if: @@ -1339,7 +1280,6 @@ ff_wc_equal(char_u *s1, char_u *s2) } return s1[i] == s2[j]; } -#endif /* * maintains the list of already visited files and dirs @@ -1353,11 +1293,8 @@ ff_wc_equal(char_u *s1, char_u *s2) static int ff_check_visited( ff_visited_T **visited_list, - char_u *fname -#ifdef FEAT_PATH_EXTRA - , char_u *wc_path -#endif - ) + char_u *fname, + char_u *wc_path) { ff_visited_T *vp; #ifdef UNIX @@ -1397,10 +1334,8 @@ ff_check_visited( fnamecmp(vp->ffv_fname, ff_expand_buffer) == 0 ) { -#ifdef FEAT_PATH_EXTRA // are the wildcard parts equal if (ff_wc_equal(vp->ffv_wc_path, wc_path) == TRUE) -#endif // already visited return FAIL; } @@ -1429,12 +1364,10 @@ ff_check_visited( #ifdef UNIX } #endif -#ifdef FEAT_PATH_EXTRA if (wc_path != NULL) vp->ffv_wc_path = vim_strsave(wc_path); else vp->ffv_wc_path = NULL; -#endif vp->ffv_next = *visited_list; *visited_list = vp; @@ -1449,9 +1382,7 @@ ff_check_visited( static ff_stack_T * ff_create_stack_element( char_u *fix_part, -#ifdef FEAT_PATH_EXTRA char_u *wc_part, -#endif int level, int star_star_empty) { @@ -1474,17 +1405,11 @@ ff_create_stack_element( fix_part = (char_u *)""; new->ffs_fix_path = vim_strsave(fix_part); -#ifdef FEAT_PATH_EXTRA if (wc_part == NULL) wc_part = (char_u *)""; new->ffs_wc_path = vim_strsave(wc_part); -#endif - if (new->ffs_fix_path == NULL -#ifdef FEAT_PATH_EXTRA - || new->ffs_wc_path == NULL -#endif - ) + if (new->ffs_fix_path == NULL || new->ffs_wc_path == NULL) { ff_free_stack_element(new); new = NULL; @@ -1532,9 +1457,7 @@ ff_free_stack_element(ff_stack_T *stack_ptr) { // vim_free handles possible NULL pointers vim_free(stack_ptr->ffs_fix_path); -#ifdef FEAT_PATH_EXTRA vim_free(stack_ptr->ffs_wc_path); -#endif if (stack_ptr->ffs_filearray != NULL) FreeWild(stack_ptr->ffs_filearray_size, stack_ptr->ffs_filearray); @@ -1557,11 +1480,8 @@ ff_clear(ff_search_ctx_T *search_ctx) vim_free(search_ctx->ffsc_file_to_search); vim_free(search_ctx->ffsc_start_dir); vim_free(search_ctx->ffsc_fix_path); -#ifdef FEAT_PATH_EXTRA vim_free(search_ctx->ffsc_wc_path); -#endif -#ifdef FEAT_PATH_EXTRA if (search_ctx->ffsc_stopdirs_v != NULL) { int i = 0; @@ -1574,19 +1494,15 @@ ff_clear(ff_search_ctx_T *search_ctx) vim_free(search_ctx->ffsc_stopdirs_v); } search_ctx->ffsc_stopdirs_v = NULL; -#endif // reset everything search_ctx->ffsc_file_to_search = NULL; search_ctx->ffsc_start_dir = NULL; search_ctx->ffsc_fix_path = NULL; -#ifdef FEAT_PATH_EXTRA search_ctx->ffsc_wc_path = NULL; search_ctx->ffsc_level = 0; -#endif } -#ifdef FEAT_PATH_EXTRA /* * check if the given path is in the stopdirs * returns TRUE if yes else FALSE @@ -1623,7 +1539,6 @@ ff_path_in_stoplist(char_u *path, int path_len, char_u **stopdirs_v) } return FALSE; } -#endif /* * Find the file name "ptr[len]" in the path. Also finds directory names. @@ -1873,12 +1788,8 @@ find_file_in_path_option( buf[0] = 0; copy_option_part(&dir, buf, MAXPATHL, " ,"); -# ifdef FEAT_PATH_EXTRA // get the stopdir string r_ptr = vim_findfile_stopdir(buf); -# else - r_ptr = NULL; -# endif fdip_search_ctx = vim_findfile_init(buf, ff_file_to_find, r_ptr, 100, FALSE, find_what, fdip_search_ctx, FALSE, rel_fname); diff --git a/src/tag.c b/src/tag.c index 02f0818fec..3141e7686f 100644 --- a/src/tag.c +++ b/src/tag.c @@ -3398,11 +3398,7 @@ get_tagfname( buf[0] = NUL; (void)copy_option_part(&tnp->tn_np, buf, MAXPATHL - 1, " ,"); -#ifdef FEAT_PATH_EXTRA r_ptr = vim_findfile_stopdir(buf); -#else - r_ptr = NULL; -#endif // move the filename one char forward and truncate the // filepath with a NUL filename = gettail(buf); diff --git a/src/version.c b/src/version.c index b794c0c886..255725f22a 100644 --- a/src/version.c +++ b/src/version.c @@ -448,11 +448,7 @@ static char *(features[]) = #else "-packages", #endif -#ifdef FEAT_PATH_EXTRA "+path_extra", -#else - "-path_extra", -#endif #ifdef FEAT_PERL # ifdef DYNAMIC_PERL "+perl/dyn", @@ -727,6 +723,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 270, /**/ 269, /**/