mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
commit
ef33500e17
@ -1422,8 +1422,8 @@ int vgetc(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a keypad or special function key was not mapped, use it like
|
// a keypad or special function key was not mapped, use it like
|
||||||
* its ASCII equivalent */
|
// its ASCII equivalent
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case K_KPLUS: c = '+'; break;
|
case K_KPLUS: c = '+'; break;
|
||||||
case K_KMINUS: c = '-'; break;
|
case K_KMINUS: c = '-'; break;
|
||||||
@ -1475,25 +1475,25 @@ int vgetc(void)
|
|||||||
case K_XRIGHT: c = K_RIGHT; break;
|
case K_XRIGHT: c = K_RIGHT; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For a multi-byte character get all the bytes and return the
|
// For a multi-byte character get all the bytes and return the
|
||||||
* converted character.
|
// converted character.
|
||||||
* Note: This will loop until enough bytes are received!
|
// Note: This will loop until enough bytes are received!
|
||||||
*/
|
if ((n = MB_BYTE2LEN_CHECK(c)) > 1) {
|
||||||
if (has_mbyte && (n = MB_BYTE2LEN_CHECK(c)) > 1) {
|
|
||||||
no_mapping++;
|
no_mapping++;
|
||||||
buf[0] = (char_u)c;
|
buf[0] = (char_u)c;
|
||||||
for (i = 1; i < n; i++) {
|
for (i = 1; i < n; i++) {
|
||||||
buf[i] = (char_u)vgetorpeek(true);
|
buf[i] = (char_u)vgetorpeek(true);
|
||||||
if (buf[i] == K_SPECIAL
|
if (buf[i] == K_SPECIAL
|
||||||
) {
|
) {
|
||||||
/* Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER sequence,
|
// Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER sequence,
|
||||||
* which represents a K_SPECIAL (0x80),
|
// which represents a K_SPECIAL (0x80),
|
||||||
* or a CSI - KS_EXTRA - KE_CSI sequence, which represents
|
// or a CSI - KS_EXTRA - KE_CSI sequence, which represents
|
||||||
* a CSI (0x9B),
|
// a CSI (0x9B),
|
||||||
* of a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI too. */
|
// of a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI too.
|
||||||
c = vgetorpeek(TRUE);
|
c = vgetorpeek(true);
|
||||||
if (vgetorpeek(TRUE) == (int)KE_CSI && c == KS_EXTRA)
|
if (vgetorpeek(true) == (int)KE_CSI && c == KS_EXTRA) {
|
||||||
buf[i] = CSI;
|
buf[i] = CSI;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
no_mapping--;
|
no_mapping--;
|
||||||
|
@ -983,25 +983,29 @@ do_execreg(
|
|||||||
EMSG(_(e_nolastcmd));
|
EMSG(_(e_nolastcmd));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
XFREE_CLEAR(new_last_cmdline); // don't keep the cmdline containing @:
|
// don't keep the cmdline containing @:
|
||||||
|
XFREE_CLEAR(new_last_cmdline);
|
||||||
// Escape all control characters with a CTRL-V
|
// Escape all control characters with a CTRL-V
|
||||||
p = vim_strsave_escaped_ext(
|
p = vim_strsave_escaped_ext(
|
||||||
last_cmdline,
|
last_cmdline,
|
||||||
(char_u *)
|
(char_u *)"\001\002\003\004\005\006\007"
|
||||||
"\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037",
|
"\010\011\012\013\014\015\016\017"
|
||||||
Ctrl_V, FALSE);
|
"\020\021\022\023\024\025\026\027"
|
||||||
/* When in Visual mode "'<,'>" will be prepended to the command.
|
"\030\031\032\033\034\035\036\037",
|
||||||
* Remove it when it's already there. */
|
Ctrl_V, false);
|
||||||
if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0)
|
// When in Visual mode "'<,'>" will be prepended to the command.
|
||||||
retval = put_in_typebuf(p + 5, TRUE, TRUE, silent);
|
// Remove it when it's already there.
|
||||||
else
|
if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0) {
|
||||||
retval = put_in_typebuf(p, TRUE, TRUE, silent);
|
retval = put_in_typebuf(p + 5, true, true, silent);
|
||||||
|
} else {
|
||||||
|
retval = put_in_typebuf(p, true, true, silent);
|
||||||
|
}
|
||||||
xfree(p);
|
xfree(p);
|
||||||
} else if (regname == '=') {
|
} else if (regname == '=') {
|
||||||
p = get_expr_line();
|
p = get_expr_line();
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
retval = put_in_typebuf(p, TRUE, colon, silent);
|
retval = put_in_typebuf(p, true, colon, silent);
|
||||||
xfree(p);
|
xfree(p);
|
||||||
} else if (regname == '.') { /* use last inserted text */
|
} else if (regname == '.') { /* use last inserted text */
|
||||||
p = get_last_insert_save();
|
p = get_last_insert_save();
|
||||||
@ -1009,7 +1013,7 @@ do_execreg(
|
|||||||
EMSG(_(e_noinstext));
|
EMSG(_(e_noinstext));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
retval = put_in_typebuf(p, FALSE, colon, silent);
|
retval = put_in_typebuf(p, false, colon, silent);
|
||||||
xfree(p);
|
xfree(p);
|
||||||
} else {
|
} else {
|
||||||
yankreg_T *reg = get_yank_register(regname, YREG_PASTE);
|
yankreg_T *reg = get_yank_register(regname, YREG_PASTE);
|
||||||
@ -1075,8 +1079,8 @@ static void put_reedit_in_typebuf(int silent)
|
|||||||
*/
|
*/
|
||||||
static int put_in_typebuf(
|
static int put_in_typebuf(
|
||||||
char_u *s,
|
char_u *s,
|
||||||
int esc,
|
bool esc,
|
||||||
int colon, /* add ':' before the line */
|
bool colon, // add ':' before the line
|
||||||
int silent
|
int silent
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ func Test_writefile_fails_conversion()
|
|||||||
endif
|
endif
|
||||||
" Without a backup file the write won't happen if there is a conversion
|
" Without a backup file the write won't happen if there is a conversion
|
||||||
" error.
|
" error.
|
||||||
set nobackup nowritebackup
|
set nobackup nowritebackup backupdir=. backupskip=
|
||||||
new
|
new
|
||||||
let contents = ["line one", "line two"]
|
let contents = ["line one", "line two"]
|
||||||
call writefile(contents, 'Xfile')
|
call writefile(contents, 'Xfile')
|
||||||
@ -49,7 +49,7 @@ func Test_writefile_fails_conversion()
|
|||||||
|
|
||||||
call delete('Xfile')
|
call delete('Xfile')
|
||||||
bwipe!
|
bwipe!
|
||||||
set backup& writebackup&
|
set backup& writebackup& backupdir&vim backupskip&vim
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_writefile_fails_conversion2()
|
func Test_writefile_fails_conversion2()
|
||||||
@ -58,7 +58,7 @@ func Test_writefile_fails_conversion2()
|
|||||||
endif
|
endif
|
||||||
" With a backup file the write happens even if there is a conversion error,
|
" With a backup file the write happens even if there is a conversion error,
|
||||||
" but then the backup file must remain
|
" but then the backup file must remain
|
||||||
set nobackup writebackup
|
set nobackup writebackup backupdir=. backupskip=
|
||||||
let contents = ["line one", "line two"]
|
let contents = ["line one", "line two"]
|
||||||
call writefile(contents, 'Xfile_conversion_err')
|
call writefile(contents, 'Xfile_conversion_err')
|
||||||
edit Xfile_conversion_err
|
edit Xfile_conversion_err
|
||||||
@ -71,6 +71,7 @@ func Test_writefile_fails_conversion2()
|
|||||||
call delete('Xfile_conversion_err')
|
call delete('Xfile_conversion_err')
|
||||||
call delete('Xfile_conversion_err~')
|
call delete('Xfile_conversion_err~')
|
||||||
bwipe!
|
bwipe!
|
||||||
|
set backup& writebackup& backupdir&vim backupskip&vim
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func SetFlag(timer)
|
func SetFlag(timer)
|
||||||
|
Loading…
Reference in New Issue
Block a user