summaryrefslogtreecommitdiffstats
path: root/src/misc1.c
diff options
context:
space:
mode:
authorK.Takata <kentkt@csc.jp>2023-02-15 19:13:43 +0000
committerBram Moolenaar <Bram@vim.org>2023-02-15 19:13:43 +0000
commitce3189d56e867a2ffc077893b62f530d5b09150f (patch)
tree52d7934c1c7c1a85fe3c1a62c24ad0ceb1d2b5b9 /src/misc1.c
parentbc3dc298b37820a8212e7d839e882e07d6cc98c8 (diff)
patch 9.0.1313: some settings use the current codepage instead of 'encoding'v9.0.1313
Problem: Some settings use the current codepage instead of 'encoding'. Solution: Adjust how options are initialized. (Ken Takata, closes #11992)
Diffstat (limited to 'src/misc1.c')
-rw-r--r--src/misc1.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/misc1.c b/src/misc1.c
index d369f2aa24..c83b7ae0d5 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -1311,6 +1311,32 @@ free_users(void)
}
#endif
+#if defined(MSWIN) || defined(PROTO)
+/*
+ * Initilize $VIM and $VIMRUNTIME when 'enc' is updated.
+ */
+ void
+init_vimdir(void)
+{
+ int mustfree;
+ char_u *p;
+
+ mch_get_exe_name();
+
+ mustfree = FALSE;
+ didset_vim = FALSE;
+ p = vim_getenv((char_u *)"VIM", &mustfree);
+ if (mustfree)
+ vim_free(p);
+
+ mustfree = FALSE;
+ didset_vimruntime = FALSE;
+ p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
+ if (mustfree)
+ vim_free(p);
+}
+#endif
+
/*
* Call expand_env() and store the result in an allocated string.
* This is not very memory efficient, this expects the result to be freed
@@ -1696,7 +1722,7 @@ vim_version_dir(char_u *vimdir)
* Vim's version of getenv().
* Special handling of $HOME, $VIM and $VIMRUNTIME.
* Also does ACP to 'enc' conversion for Win32.
- * "mustfree" is set to TRUE when returned is allocated, it must be
+ * "mustfree" is set to TRUE when the returned string is allocated. It must be
* initialized to FALSE by the caller.
*/
char_u *