commit e5665754d1b20a531d6168ad0efece486fb86a17
parent e01f196e445a1b599710caae3c18dd89dbaa6907
Author: brianhuster <phambinhanctb2004@gmail.com>
Date: Tue, 13 May 2025 06:54:48 +0700
fix(tutor): l:lang is undefined
Problem:
The scope `elseif $LC_MESSAGES =~ '\a\a' || $LC_MESSAGES ==# "C"` in
function `s:Locale` in file `runtime/autoload/tutor.vim` leaves a case
when l:lang is not defined.
Solution:
Define `l:lang` at function scope instead of `if` scope
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim
@@ -120,6 +120,8 @@ endfunction
" Tutor Cmd: {{{1
function! s:Locale()
+ " Make sure l:lang exists before returning.
+ let l:lang = 'en_US'
if exists('v:lang') && v:lang =~ '\a\a'
let l:lang = v:lang
elseif $LC_ALL =~ '\a\a'
@@ -132,8 +134,6 @@ function! s:Locale()
endif
elseif $LANG =~ '\a\a'
let l:lang = $LANG
- else
- let l:lang = 'en_US'
endif
return split(l:lang, '_')
endfunction