Loading ...
Sorry, an error occurred while loading the content.

Re: [patch] vim-gnome resets LC_NUMERIC

Expand Messages
  • Bram Moolenaar
    ... Thanks, I ll add it to the todo list. -- hundred-and-one symptoms of being an internet addict: 162. You go outside and look for a brightness knob to turn
    Message 1 of 2 , Dec 14, 2012
    • 0 Attachment
      Christian Brabandt wrote:

      > I noticed, my gvim started behaving strange when using the gnome
      > version.
      > It turned out, that some script was doing something like :echo 1+1.0
      > and Vim threw an E806 error at me:
      > ,----
      > | E806: using Float as a String
      > | E15: Invalid expression: 1+1.0
      > `----
      >
      > Interestingly, :lang returns:
      > Current language:
      > "LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=de_DE.UTF-8;LC_TIME=de_DE.UTF-8;LC_COLLATE=de_DE.UTF-8;LC_MONETARY=de_DE.UTF-8;LC_MESSAGES=C;LC_PAPER=de_DE.UTF-8;LC_NAME=de_DE.UTF-8;LC_ADDRESS=de_DE.UTF-8;LC_TELEPHONE=de_DE.UTF-8;LC_MEASUREMENT=de_DE.UTF-8;LC_IDENTIFICATION=de_DE.UTF-8"
      >
      > So I started to debug this issue and finally found out, that apparently
      > gnome_program_init resets the locale. So here is a patch:
      >
      > diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
      > --- a/src/gui_gtk_x11.c
      > +++ b/src/gui_gtk_x11.c
      > @@ -3132,6 +3132,11 @@
      > if (using_gnome)
      > gnome_program_init(VIMPACKAGE, VIM_VERSION_SHORT,
      > LIBGNOMEUI_MODULE, gui_argc, gui_argv, NULL);
      > +#if defined(FEAT_FLOAT) && defined(LC_NUMERIC)
      > + if (setlocale(LC_NUMERIC, NULL) != (char *) "C")
      > + /* Make sure strtod() uses a decimal point, not a comma. */
      > + setlocale(LC_NUMERIC, "C");
      > +#endif
      > #endif

      Thanks, I'll add it to the todo list.

      --
      hundred-and-one symptoms of being an internet addict:
      162. You go outside and look for a brightness knob to turn down the sun.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.