summaryrefslogtreecommitdiff
path: root/src/gui_x11.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-13 16:23:40 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-13 16:23:40 +0200
commit889fe2c2b9ba5c92b7e862a4aafbd863585fd633 (patch)
tree0c90bf049f96ee9614f788681b2102554dad048b /src/gui_x11.c
parent137374fd6538cf9dee0cb22907728d8fdecb5832 (diff)
downloadvim-git-889fe2c2b9ba5c92b7e862a4aafbd863585fd633.tar.gz
patch 8.0.1833: X11: ":echo 3.14" gives E806v8.0.1833
Problem: X11: ":echo 3.14" gives E806. Solution: set LC_NUMERIC to "C". (Dominique Pelle, closes #2368)
Diffstat (limited to 'src/gui_x11.c')
-rw-r--r--src/gui_x11.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui_x11.c b/src/gui_x11.c
index 490844969..7a5cae03e 100644
--- a/src/gui_x11.c
+++ b/src/gui_x11.c
@@ -1282,6 +1282,17 @@ gui_mch_init_check(void)
cmdline_options, XtNumber(cmdline_options),
CARDINAL &gui_argc, gui_argv);
+# if defined(FEAT_FLOAT) && defined(LC_NUMERIC)
+ {
+ /* The call to XtOpenDisplay() may have set the locale from the
+ * environment. Set LC_NUMERIC to "C" to make sure that strtod() uses a
+ * decimal point, not a comma. */
+ char *p = setlocale(LC_NUMERIC, NULL);
+
+ if (p == NULL || strcmp(p, "C") != 0)
+ setlocale(LC_NUMERIC, "C");
+ }
+# endif
if (app_context == NULL || gui.dpy == NULL)
{
gui.dying = TRUE;