Merge #6344 'vim-patch:7.4.2236,7.4.2306'

This commit is contained in:
Justin M. Keyes 2017-04-01 17:33:32 +02:00
commit 33ff29fc74
9 changed files with 94 additions and 27 deletions

View File

@ -44,6 +44,7 @@ Functions ~
Options ~ Options ~
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used. *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
*'langnoremap'* Deprecated alias to 'nolangremap'.
*'vi'* *'vi'*
*'viminfo'* Deprecated alias to 'shada' option. *'viminfo'* Deprecated alias to 'shada' option.

View File

@ -3762,12 +3762,12 @@ A jump table for the options with a short description can be found at |Q_op|.
:source $VIMRUNTIME/menu.vim :source $VIMRUNTIME/menu.vim
< Warning: This deletes all menus that you defined yourself! < Warning: This deletes all menus that you defined yourself!
*'langnoremap'* *'lnr'* *'langremap'* *'lrm'* *'nolangremap'* *'nolrm'*
'langnoremap' 'lnr' boolean (default on) 'langremap' 'lrm' boolean (default off)
global global
When on, setting 'langmap' does not apply to characters resulting from When off, setting 'langmap' does not apply to characters resulting from
a mapping. If setting 'langmap' disables some of your mappings, make a mapping. If setting 'langmap' disables some of your mappings, make
sure this option is set. sure this option is off.
*'laststatus'* *'ls'* *'laststatus'* *'ls'*
'laststatus' 'ls' number (default 2) 'laststatus' 'ls' number (default 2)

View File

@ -45,7 +45,8 @@ these differences.
- 'history' defaults to 10000 (the maximum) - 'history' defaults to 10000 (the maximum)
- 'hlsearch' is set by default - 'hlsearch' is set by default
- 'incsearch' is set by default - 'incsearch' is set by default
- 'langnoremap' is set by default - 'langnoremap' is enabled by default
- 'langremap' is disabled by default
- 'laststatus' defaults to 2 (statusline is always shown) - 'laststatus' defaults to 2 (statusline is always shown)
- 'listchars' defaults to "tab:> ,trail:-,nbsp:+" - 'listchars' defaults to "tab:> ,trail:-,nbsp:+"
- 'nocompatible' is always set - 'nocompatible' is always set

View File

@ -94,7 +94,7 @@
do { \ do { \
if (*p_langmap \ if (*p_langmap \
&& (condition) \ && (condition) \
&& (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \ && (p_lrm || (!p_lrm && KeyTyped)) \
&& !KeyStuffed \ && !KeyStuffed \
&& (c) >= 0) \ && (c) >= 0) \
{ \ { \

View File

@ -3630,6 +3630,12 @@ static char *set_bool_option(const int opt_idx, char_u *const varp,
} else if ((int *)varp == &p_force_off && p_force_off == true) { } else if ((int *)varp == &p_force_off && p_force_off == true) {
p_force_off = false; p_force_off = false;
return (char *)e_unsupportedoption; return (char *)e_unsupportedoption;
} else if ((int *)varp == &p_lrm) {
// 'langremap' -> !'langnoremap'
p_lnr = !p_lrm;
} else if ((int *)varp == &p_lnr) {
// 'langnoremap' -> !'langremap'
p_lrm = !p_lnr;
// 'undofile' // 'undofile'
} else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) { } else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) {
// Only take action when the option was set. When reset we do not // Only take action when the option was set. When reset we do not

View File

@ -476,8 +476,9 @@ EXTERN char_u *p_isp; // 'isprint'
EXTERN int p_js; // 'joinspaces' EXTERN int p_js; // 'joinspaces'
EXTERN char_u *p_kp; // 'keywordprg' EXTERN char_u *p_kp; // 'keywordprg'
EXTERN char_u *p_km; // 'keymodel' EXTERN char_u *p_km; // 'keymodel'
EXTERN char_u *p_langmap; // 'langmap'*/ EXTERN char_u *p_langmap; // 'langmap'
EXTERN int p_lnr; // 'langnoremap'*/ EXTERN int p_lnr; // 'langnoremap'
EXTERN int p_lrm; // 'langremap'
EXTERN char_u *p_lm; // 'langmenu' EXTERN char_u *p_lm; // 'langmenu'
EXTERN char_u *p_lispwords; // 'lispwords' EXTERN char_u *p_lispwords; // 'lispwords'
EXTERN long p_ls; // 'laststatus' EXTERN long p_ls; // 'laststatus'

View File

@ -1346,6 +1346,12 @@ return {
varname='p_lnr', varname='p_lnr',
defaults={if_true={vi=false, vim=true}} defaults={if_true={vi=false, vim=true}}
}, },
{
full_name='langremap', abbreviation='lrm',
type='bool', scope={'global'},
varname='p_lrm',
defaults={if_true={vi=true, vim=false}}
},
{ {
full_name='laststatus', abbreviation='ls', full_name='laststatus', abbreviation='ls',
type='number', scope={'global'}, type='number', scope={'global'},

View File

@ -35,29 +35,81 @@ func Test_map_ctrl_c_visual()
endfunc endfunc
func Test_map_langmap() func Test_map_langmap()
" langmap should not get remapped in insert mode if !has('langmap')
inoremap { FAIL_ilangmap return
set langmap=+{ langnoremap endif
" check langmap applies in normal mode
set langmap=+- nolangremap
new
call setline(1, ['a', 'b', 'c'])
2
call assert_equal('b', getline('.'))
call feedkeys("+", "xt")
call assert_equal('a', getline('.'))
" check no remapping
map x +
2
call feedkeys("x", "xt")
call assert_equal('c', getline('.'))
" check with remapping
set langremap
2
call feedkeys("x", "xt")
call assert_equal('a', getline('.'))
unmap x
bwipe!
" 'langnoremap' follows 'langremap' and vise versa
set langremap
set langnoremap
call assert_equal(0, &langremap)
set langremap
call assert_equal(0, &langnoremap)
set nolangremap
call assert_equal(1, &langnoremap)
" check default values
set langnoremap&
call assert_equal(1, &langnoremap)
call assert_equal(0, &langremap)
set langremap&
call assert_equal(1, &langnoremap)
call assert_equal(0, &langremap)
" langmap should not apply in insert mode, 'langremap' doesn't matter
set langmap=+{ nolangremap
call feedkeys("Go+\<Esc>", "xt")
call assert_equal('+', getline('$'))
set langmap=+{ langremap
call feedkeys("Go+\<Esc>", "xt") call feedkeys("Go+\<Esc>", "xt")
call assert_equal('+', getline('$')) call assert_equal('+', getline('$'))
" Insert-mode expr mapping with langmap " langmap used for register name in insert mode.
inoremap <expr> { "FAIL_iexplangmap" call setreg('a', 'aaaa')
call feedkeys("Go+\<Esc>", "xt") call setreg('b', 'bbbb')
call assert_equal('+', getline('$')) call setreg('c', 'cccc')
iunmap <expr> { set langmap=ab langremap
call feedkeys("Go\<C-R>a\<Esc>", "xt")
" langmap should not get remapped in Command-line mode call assert_equal('bbbb', getline('$'))
cnoremap { FAIL_clangmap call feedkeys("Go\<C-R>\<C-R>a\<Esc>", "xt")
call assert_equal('bbbb', getline('$'))
" mapping does not apply
imap c a
call feedkeys("Go\<C-R>c\<Esc>", "xt")
call assert_equal('cccc', getline('$'))
imap a c
call feedkeys("Go\<C-R>a\<Esc>", "xt")
call assert_equal('bbbb', getline('$'))
" langmap should not apply in Command-line mode
set langmap=+{ nolangremap
call feedkeys(":call append(line('$'), '+')\<CR>", "xt") call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
call assert_equal('+', getline('$')) call assert_equal('+', getline('$'))
cunmap {
" Command-line mode expr mapping with langmap
cnoremap <expr> { "FAIL_cexplangmap"
call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
call assert_equal('+', getline('$'))
cunmap {
set nomodified set nomodified
endfunc endfunc

View File

@ -135,7 +135,7 @@ static const int included_patches[] = {
2309, 2309,
// 2308 NA // 2308 NA
2307, 2307,
// 2306, 2306,
2305, 2305,
// 2304 NA // 2304 NA
2303, 2303,
@ -205,7 +205,7 @@ static const int included_patches[] = {
// 2239, // 2239,
// 2238 NA // 2238 NA
2237, 2237,
// 2236, 2236,
2235, 2235,
// 2234 NA // 2234 NA
2233, 2233,