1
0
forked from aniani/vim

patch 8.2.4045: some global functions are only used in one file

Problem:    Some global functions are only used in one file.
Solution:   Make the functions static. (Yegappan Lakshmanan, closes #9492)
This commit is contained in:
Yegappan Lakshmanan
2022-01-08 18:43:40 +00:00
committed by Bram Moolenaar
parent 7c24dfddc2
commit 782b43d894
11 changed files with 117 additions and 119 deletions

View File

@@ -4734,6 +4734,54 @@ win_enter(win_T *wp, int undo_sync)
| WEE_TRIGGER_ENTER_AUTOCMDS | WEE_TRIGGER_LEAVE_AUTOCMDS);
}
/*
* 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
@@ -4858,54 +4906,6 @@ win_enter_ext(win_T *wp, int flags)
return did_decrement;
}
/*
* 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.