diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-01-08 18:43:40 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-08 18:43:40 +0000 |
commit | 782b43d89473dac00e3a8e02224a8330b88dbfef (patch) | |
tree | 4309b548ce74ff64dccec70435826e602d3b21e8 /src/window.c | |
parent | 7c24dfddc28776eeff7464982ae5b94e187b6135 (diff) | |
download | vim-git-782b43d89473dac00e3a8e02224a8330b88dbfef.tar.gz |
patch 8.2.4045: some global functions are only used in one filev8.2.4045
Problem: Some global functions are only used in one file.
Solution: Make the functions static. (Yegappan Lakshmanan, closes #9492)
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/src/window.c b/src/window.c index 6d5d0a4b8..05e85baf3 100644 --- a/src/window.c +++ b/src/window.c @@ -4735,6 +4735,54 @@ win_enter(win_T *wp, int undo_sync) } /* + * Used after making another window the current one: change directory if + * needed. + */ + static void +fix_current_dir(void) +{ +#ifdef FEAT_AUTOCHDIR + if (p_acd) + do_autochdir(); + else +#endif + if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL) + { + char_u *dirname; + + // Window or tab has a local directory: Save current directory as + // global directory (unless that was done already) and change to the + // local directory. + if (globaldir == NULL) + { + char_u cwd[MAXPATHL]; + + if (mch_dirname(cwd, MAXPATHL) == OK) + globaldir = vim_strsave(cwd); + } + if (curwin->w_localdir != NULL) + dirname = curwin->w_localdir; + else + dirname = curtab->tp_localdir; + + if (mch_chdir((char *)dirname) == 0) + { + last_chdir_reason = NULL; + shorten_fnames(TRUE); + } + } + else if (globaldir != NULL) + { + // Window doesn't have a local directory and we are not in the global + // directory: Change to the global directory. + vim_ignored = mch_chdir((char *)globaldir); + VIM_CLEAR(globaldir); + last_chdir_reason = NULL; + shorten_fnames(TRUE); + } +} + +/* * Make window "wp" the current window. * Can be called with "flags" containing WEE_CURWIN_INVALID, which means that * curwin has just been closed and isn't valid. @@ -4859,54 +4907,6 @@ win_enter_ext(win_T *wp, int flags) } /* - * Used after making another window the current one: change directory if - * needed. - */ - void -fix_current_dir(void) -{ -#ifdef FEAT_AUTOCHDIR - if (p_acd) - do_autochdir(); - else -#endif - if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL) - { - char_u *dirname; - - // Window or tab has a local directory: Save current directory as - // global directory (unless that was done already) and change to the - // local directory. - if (globaldir == NULL) - { - char_u cwd[MAXPATHL]; - - if (mch_dirname(cwd, MAXPATHL) == OK) - globaldir = vim_strsave(cwd); - } - if (curwin->w_localdir != NULL) - dirname = curwin->w_localdir; - else - dirname = curtab->tp_localdir; - - if (mch_chdir((char *)dirname) == 0) - { - last_chdir_reason = NULL; - shorten_fnames(TRUE); - } - } - else if (globaldir != NULL) - { - // Window doesn't have a local directory and we are not in the global - // directory: Change to the global directory. - vim_ignored = mch_chdir((char *)globaldir); - VIM_CLEAR(globaldir); - last_chdir_reason = NULL; - shorten_fnames(TRUE); - } -} - -/* * Jump to the first open window that contains buffer "buf", if one exists. * Returns a pointer to the window found, otherwise NULL. */ |