You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
float and str2float support broken for french (and probably every locale that use a comma as the decimal separator) #11
What steps will reproduce the problem?
Set either language to French or the region to France in the Preferences.
Type the following commands in Macvim's console ( lines prefixed by >> are the
answer, E123 are error codes):
:let a=0.5
>> E806 + E15
:let a=0,5
>> E806 + E15 + E15
:let a=str2float('0.5')
:let a
>> 0,0
:let a=str2float('0,5')
:let a
>> 0,5
What is the expected output? What do you see instead?
Here's what I should get:
:let a=0.5
:let a
>> 0.5
:let a=0,5
>> E15
:let a=str2float('0.5')
:let a
>> 0.5
:let a=str2float('0,5')
:let a
>> 0.0
Note that I was able to get the expected result when I started
/Applications/MacVim.app/Contents/MacOS/MacVim from the Terminal with no LC_*
env variables. The problem only exist when the app is started from the finder,
the dock or Alfred.
What version of MacVim and OS X are you using (see "MacVim->About MacVim"
and "Apple Menu->About This Mac" menu items, e.g. "Snapshot 40, 10.5.6
Intel")?
Tested with both snapshots 69 and release 73 (which I hoped would fix the
issue), under Mavericks 10.9.4
Original issue reported on code.google.com by yann.cou...@gmail.com on 9 Sep 2014 at 1:45
I made some progress on identifying the problem.
After adding some debugging code in src/eval.c to dump the current locale (via
getlocale) in string2float I see it's different when launched via the command
line (it's C as it should, even if I force it to another value from the shell)
whereas it's fr_FR when launched from the finder. I have no explanation yet,
but I guess it helps to explain the difference in behavior.
Attached, is the butt-ugly debug code I used
Original comment by yann.cou...@gmail.com on 19 Nov 2014 at 6:18
I reported this as vim/vim#7003. However, the bug might still be MacVim-specific.
Vim tries to guard against this issue by running setlocale(LC_NUMERIC, "C") at startup, which is supposed to make float parsing independent of the system locale. This works fine when running (Mac)Vim from the terminal, but apparently not if MacVim is run from Finder.
Wow, never realized my issue had been exported automatically. Seeing the issue I've had for the past 6 years solved in the latest changelog really made my day. But I had no idea it was based on my initial report that had been migrated. Thank you all for solving this!
Activity
douglaskayama commentedon May 4, 2015
From @GoogleCodeExporter on March 16, 2015 9:25
Original comment by
yann.cou...@gmail.comon 19 Nov 2014 at 6:18Attachments:
splhack commentedon Nov 7, 2015
It should be reported https://github.com/vim/vim/issues or Vim mailing list.
denisw commentedon Sep 23, 2020
I reported this as vim/vim#7003. However, the bug might still be MacVim-specific.
Vim tries to guard against this issue by running
setlocale(LC_NUMERIC, "C")at startup, which is supposed to make float parsing independent of the system locale. This works fine when running (Mac)Vim from the terminal, but apparently not if MacVim is run from Finder.denisw commentedon Sep 23, 2020
Bram Moolenaar wrote this in vim/vim#7003:
ychin commentedon Sep 25, 2020
Fixed upstream in vim/vim@509f803
MacVim Snapshot 167
MacVim Snapshot 168
yanncoupin commentedon Dec 13, 2020
Wow, never realized my issue had been exported automatically. Seeing the issue I've had for the past 6 years solved in the latest changelog really made my day. But I had no idea it was based on my initial report that had been migrated. Thank you all for solving this!