comparison src/window.c @ 27032:18cafa092e8d v8.2.4045

patch 8.2.4045: some global functions are only used in one file Commit: https://github.com/vim/vim/commit/782b43d89473dac00e3a8e02224a8330b88dbfef Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Jan 8 18:43:40 2022 +0000 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 https://github.com/vim/vim/issues/9492)
author Bram Moolenaar <Bram@vim.org>
date Sat, 08 Jan 2022 19:45:03 +0100
parents c9474ae175f4
children 85f56e16da9b
comparison
equal deleted inserted replaced
27031:348fe9745475 27032:18cafa092e8d
4733 (void)win_enter_ext(wp, (undo_sync ? WEE_UNDO_SYNC : 0) 4733 (void)win_enter_ext(wp, (undo_sync ? WEE_UNDO_SYNC : 0)
4734 | WEE_TRIGGER_ENTER_AUTOCMDS | WEE_TRIGGER_LEAVE_AUTOCMDS); 4734 | WEE_TRIGGER_ENTER_AUTOCMDS | WEE_TRIGGER_LEAVE_AUTOCMDS);
4735 } 4735 }
4736 4736
4737 /* 4737 /*
4738 * Used after making another window the current one: change directory if
4739 * needed.
4740 */
4741 static void
4742 fix_current_dir(void)
4743 {
4744 #ifdef FEAT_AUTOCHDIR
4745 if (p_acd)
4746 do_autochdir();
4747 else
4748 #endif
4749 if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL)
4750 {
4751 char_u *dirname;
4752
4753 // Window or tab has a local directory: Save current directory as
4754 // global directory (unless that was done already) and change to the
4755 // local directory.
4756 if (globaldir == NULL)
4757 {
4758 char_u cwd[MAXPATHL];
4759
4760 if (mch_dirname(cwd, MAXPATHL) == OK)
4761 globaldir = vim_strsave(cwd);
4762 }
4763 if (curwin->w_localdir != NULL)
4764 dirname = curwin->w_localdir;
4765 else
4766 dirname = curtab->tp_localdir;
4767
4768 if (mch_chdir((char *)dirname) == 0)
4769 {
4770 last_chdir_reason = NULL;
4771 shorten_fnames(TRUE);
4772 }
4773 }
4774 else if (globaldir != NULL)
4775 {
4776 // Window doesn't have a local directory and we are not in the global
4777 // directory: Change to the global directory.
4778 vim_ignored = mch_chdir((char *)globaldir);
4779 VIM_CLEAR(globaldir);
4780 last_chdir_reason = NULL;
4781 shorten_fnames(TRUE);
4782 }
4783 }
4784
4785 /*
4738 * Make window "wp" the current window. 4786 * Make window "wp" the current window.
4739 * Can be called with "flags" containing WEE_CURWIN_INVALID, which means that 4787 * Can be called with "flags" containing WEE_CURWIN_INVALID, which means that
4740 * curwin has just been closed and isn't valid. 4788 * curwin has just been closed and isn't valid.
4741 * Returns TRUE when dont_parse_messages was decremented. 4789 * Returns TRUE when dont_parse_messages was decremented.
4742 */ 4790 */
4854 4902
4855 // Change directories when the 'acd' option is set. 4903 // Change directories when the 'acd' option is set.
4856 DO_AUTOCHDIR; 4904 DO_AUTOCHDIR;
4857 4905
4858 return did_decrement; 4906 return did_decrement;
4859 }
4860
4861 /*
4862 * Used after making another window the current one: change directory if
4863 * needed.
4864 */
4865 void
4866 fix_current_dir(void)
4867 {
4868 #ifdef FEAT_AUTOCHDIR
4869 if (p_acd)
4870 do_autochdir();
4871 else
4872 #endif
4873 if (curwin->w_localdir != NULL || curtab->tp_localdir != NULL)
4874 {
4875 char_u *dirname;
4876
4877 // Window or tab has a local directory: Save current directory as
4878 // global directory (unless that was done already) and change to the
4879 // local directory.
4880 if (globaldir == NULL)
4881 {
4882 char_u cwd[MAXPATHL];
4883
4884 if (mch_dirname(cwd, MAXPATHL) == OK)
4885 globaldir = vim_strsave(cwd);
4886 }
4887 if (curwin->w_localdir != NULL)
4888 dirname = curwin->w_localdir;
4889 else
4890 dirname = curtab->tp_localdir;
4891
4892 if (mch_chdir((char *)dirname) == 0)
4893 {
4894 last_chdir_reason = NULL;
4895 shorten_fnames(TRUE);
4896 }
4897 }
4898 else if (globaldir != NULL)
4899 {
4900 // Window doesn't have a local directory and we are not in the global
4901 // directory: Change to the global directory.
4902 vim_ignored = mch_chdir((char *)globaldir);
4903 VIM_CLEAR(globaldir);
4904 last_chdir_reason = NULL;
4905 shorten_fnames(TRUE);
4906 }
4907 } 4907 }
4908 4908
4909 /* 4909 /*
4910 * Jump to the first open window that contains buffer "buf", if one exists. 4910 * Jump to the first open window that contains buffer "buf", if one exists.
4911 * Returns a pointer to the window found, otherwise NULL. 4911 * Returns a pointer to the window found, otherwise NULL.