Skip to content

Commit

Permalink
determining force C locale for determinging the delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbra committed Jan 11, 2019
1 parent 7aa17f0 commit 502f03d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
- Make `b:csv_result` available as result of last evaluation (Sum, Max, Deviation, etc..)
(suggested by serrussel in https://github.com/chrisbra/csv.vim/issues/127 thanks!)
- Make plugin autoloadable (https://github.com/chrisbra/csv.vim/pull/130 done by jeetsukumaran, thanks!)

- Determining the delimiter automatically depends on the locale, therefore use explicitly the
C locale to parse the output of the `:s/<del>/<del>/nge` command

## 0.31 Jan 15, 2015
- supports for Vim 7.3 dropped
Expand Down
10 changes: 9 additions & 1 deletion autoload/csv.vim
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ fu! csv#HiCol(colnr, bang) "{{{3
endif
endfu
fu! csv#GetDelimiter(first, last, ...) "{{{3
" This depends on the locale. Hopefully it works
let lang=v:lang
if lang isnot# 'C'
sil lang mess C
endif
if !exists("b:csv_fixed_width_cols")
let _cur = getpos('.')
let _s = @/
Expand Down Expand Up @@ -468,9 +473,12 @@ fu! csv#GetDelimiter(first, last, ...) "{{{3
redir END
endfor
let &lz = _lz
let Delim = map(temp, 'matchstr(substitute(v:val, "\n", "", ""), "^\\d\\+")')
let Delim = map(temp, 'matchstr(substitute(v:val, "\n", "", ""), "^\\s*\\d\\+")')
let Delim = filter(temp, 'v:val=~''\d''')
let max = max(values(temp))
if lang != 'C'
exe "sil lang mess" lang
endif

let result=[]
call setpos('.', _cur)
Expand Down

0 comments on commit 502f03d

Please sign in to comment.