mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
feat(input)!: delay some conversions to vgetc()
This commit is contained in:
@@ -1583,6 +1583,14 @@ int vgetc(void)
|
|||||||
c = utf_ptr2char(buf);
|
c = utf_ptr2char(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((mod_mask & MOD_MASK_CTRL) && (c >= '?' && c <= '_')) {
|
||||||
|
c = Ctrl_chr(c);
|
||||||
|
mod_mask &= ~MOD_MASK_CTRL;
|
||||||
|
if (c == 0) { // <C-@> is <Nul>
|
||||||
|
c = K_ZERO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If mappings are enabled (i.e., not Ctrl-v) and the user directly typed
|
// If mappings are enabled (i.e., not Ctrl-v) and the user directly typed
|
||||||
// something with a meta- or alt- modifier that was not mapped, interpret
|
// something with a meta- or alt- modifier that was not mapped, interpret
|
||||||
// <M-x> as <Esc>x rather than as an unbound meta keypress. #8213
|
// <M-x> as <Esc>x rather than as an unbound meta keypress. #8213
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include "nvim/memory.h"
|
#include "nvim/memory.h"
|
||||||
#include "nvim/message.h"
|
#include "nvim/message.h"
|
||||||
#include "nvim/mouse.h"
|
#include "nvim/mouse.h"
|
||||||
|
#include "nvim/option_defs.h"
|
||||||
#include "nvim/strings.h"
|
#include "nvim/strings.h"
|
||||||
#include "nvim/vim.h"
|
#include "nvim/vim.h"
|
||||||
|
|
||||||
@@ -744,14 +745,17 @@ static int extract_modifiers(int key, int *modp)
|
|||||||
modifiers &= ~MOD_MASK_SHIFT;
|
modifiers &= ~MOD_MASK_SHIFT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((modifiers & MOD_MASK_CTRL)
|
if ((modifiers & MOD_MASK_CTRL) && ((key >= '?' && key <= '_') || ASCII_ISALPHA(key))) {
|
||||||
&& ((key >= '?' && key <= '_') || ASCII_ISALPHA(key))) {
|
key = TOUPPER_ASC(key);
|
||||||
key = Ctrl_chr(key);
|
int new_key = Ctrl_chr(key);
|
||||||
|
if (!p_clbg || (new_key != TAB && new_key != CAR && new_key != ESC)) {
|
||||||
|
key = new_key;
|
||||||
modifiers &= ~MOD_MASK_CTRL;
|
modifiers &= ~MOD_MASK_CTRL;
|
||||||
if (key == 0) { // <C-@> is <Nul>
|
if (key == 0) { // <C-@> is <Nul>
|
||||||
key = K_ZERO;
|
key = K_ZERO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*modp = modifiers;
|
*modp = modifiers;
|
||||||
return key;
|
return key;
|
||||||
|
@@ -401,6 +401,7 @@ EXTERN int p_cst; // 'cscopetag'
|
|||||||
EXTERN long p_csto; // 'cscopetagorder'
|
EXTERN long p_csto; // 'cscopetagorder'
|
||||||
EXTERN long p_cspc; // 'cscopepathcomp'
|
EXTERN long p_cspc; // 'cscopepathcomp'
|
||||||
EXTERN int p_csverbose; // 'cscopeverbose'
|
EXTERN int p_csverbose; // 'cscopeverbose'
|
||||||
|
EXTERN int p_clbg; // 'ctrldisambig'
|
||||||
EXTERN char_u *p_debug; // 'debug'
|
EXTERN char_u *p_debug; // 'debug'
|
||||||
EXTERN char_u *p_def; // 'define'
|
EXTERN char_u *p_def; // 'define'
|
||||||
EXTERN char_u *p_inc;
|
EXTERN char_u *p_inc;
|
||||||
|
@@ -541,6 +541,13 @@ return {
|
|||||||
varname='p_csverbose',
|
varname='p_csverbose',
|
||||||
defaults={if_true=1}
|
defaults={if_true=1}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
full_name='ctrldisambig', abbreviation='clbg',
|
||||||
|
short_desc=N_(""),
|
||||||
|
type='bool', scope={'global'},
|
||||||
|
varname='p_clbg',
|
||||||
|
defaults={if_true=true}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
full_name='cursorbind', abbreviation='crb',
|
full_name='cursorbind', abbreviation='crb',
|
||||||
short_desc=N_("move cursor in window as it moves in other windows"),
|
short_desc=N_("move cursor in window as it moves in other windows"),
|
||||||
|
@@ -14,6 +14,7 @@ set fsync
|
|||||||
set laststatus=1
|
set laststatus=1
|
||||||
set listchars=eol:$
|
set listchars=eol:$
|
||||||
set joinspaces
|
set joinspaces
|
||||||
|
set noctrldisambig
|
||||||
set nohidden nosmarttab noautoindent noautoread complete-=i noruler noshowcmd
|
set nohidden nosmarttab noautoindent noautoread complete-=i noruler noshowcmd
|
||||||
set nrformats+=octal
|
set nrformats+=octal
|
||||||
set shortmess-=F
|
set shortmess-=F
|
||||||
|
@@ -35,7 +35,10 @@ describe('eval', function()
|
|||||||
endfun
|
endfun
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
before_each(clear)
|
before_each(function()
|
||||||
|
clear()
|
||||||
|
command('set noctrldisambig')
|
||||||
|
end)
|
||||||
teardown(function()
|
teardown(function()
|
||||||
os.remove('test_eval_setup.vim')
|
os.remove('test_eval_setup.vim')
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user