mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
updated for version 7.0074
This commit is contained in:
@@ -4522,14 +4522,16 @@ check_map_keycodes()
|
|||||||
* NULL otherwise
|
* NULL otherwise
|
||||||
*/
|
*/
|
||||||
char_u *
|
char_u *
|
||||||
check_map(keys, mode, exact)
|
check_map(keys, mode, exact, ign_mod)
|
||||||
char_u *keys;
|
char_u *keys;
|
||||||
int mode;
|
int mode;
|
||||||
int exact; /* require exact match */
|
int exact; /* require exact match */
|
||||||
|
int ign_mod; /* ignore preceding modifier */
|
||||||
{
|
{
|
||||||
int hash;
|
int hash;
|
||||||
int len, minlen;
|
int len, minlen;
|
||||||
mapblock_T *mp;
|
mapblock_T *mp;
|
||||||
|
char_u *s;
|
||||||
#ifdef FEAT_LOCALMAP
|
#ifdef FEAT_LOCALMAP
|
||||||
int local;
|
int local;
|
||||||
#endif
|
#endif
|
||||||
@@ -4553,14 +4555,23 @@ check_map(keys, mode, exact)
|
|||||||
{
|
{
|
||||||
/* skip entries with wrong mode, wrong length and not matching
|
/* skip entries with wrong mode, wrong length and not matching
|
||||||
* ones */
|
* ones */
|
||||||
if (mp->m_keylen < len)
|
if ((mp->m_mode & mode) && (!exact || mp->m_keylen == len))
|
||||||
minlen = mp->m_keylen;
|
{
|
||||||
else
|
if (len > mp->m_keylen)
|
||||||
minlen = len;
|
minlen = mp->m_keylen;
|
||||||
if ((mp->m_mode & mode)
|
else
|
||||||
&& (!exact || mp->m_keylen == len)
|
minlen = len;
|
||||||
&& STRNCMP(mp->m_keys, keys, minlen) == 0)
|
s = mp->m_keys;
|
||||||
return mp->m_str;
|
if (ign_mod && s[0] == K_SPECIAL && s[1] == KS_MODIFIER
|
||||||
|
&& s[2] != NUL)
|
||||||
|
{
|
||||||
|
s += 3;
|
||||||
|
if (len > mp->m_keylen - 3)
|
||||||
|
minlen = mp->m_keylen - 3;
|
||||||
|
}
|
||||||
|
if (STRNCMP(s, keys, minlen) == 0)
|
||||||
|
return mp->m_str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3785,18 +3785,18 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
|||||||
if (!justify_left)
|
if (!justify_left)
|
||||||
{
|
{
|
||||||
/* left padding with blank or zero */
|
/* left padding with blank or zero */
|
||||||
int n = min_field_width - (str_arg_l + number_of_zeros_to_pad);
|
int pn = min_field_width - (str_arg_l + number_of_zeros_to_pad);
|
||||||
|
|
||||||
if (n > 0)
|
if (pn > 0)
|
||||||
{
|
{
|
||||||
if (str_l < str_m)
|
if (str_l < str_m)
|
||||||
{
|
{
|
||||||
size_t avail = str_m - str_l;
|
size_t avail = str_m - str_l;
|
||||||
|
|
||||||
vim_memset(str + str_l, zero_padding ? '0' : ' ',
|
vim_memset(str + str_l, zero_padding ? '0' : ' ',
|
||||||
n > avail ? avail : n);
|
(size_t)pn > avail ? avail : pn);
|
||||||
}
|
}
|
||||||
str_l += n;
|
str_l += pn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3812,41 +3812,42 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
|||||||
{
|
{
|
||||||
/* insert first part of numerics (sign or '0x') before zero
|
/* insert first part of numerics (sign or '0x') before zero
|
||||||
* padding */
|
* padding */
|
||||||
int n = zero_padding_insertion_ind;
|
int zn = zero_padding_insertion_ind;
|
||||||
|
|
||||||
if (n > 0)
|
if (zn > 0)
|
||||||
{
|
{
|
||||||
if (str_l < str_m)
|
if (str_l < str_m)
|
||||||
{
|
{
|
||||||
size_t avail = str_m - str_l;
|
size_t avail = str_m - str_l;
|
||||||
|
|
||||||
mch_memmove(str + str_l, str_arg,
|
mch_memmove(str + str_l, str_arg,
|
||||||
n > avail ? avail : n);
|
(size_t)zn > avail ? avail : zn);
|
||||||
}
|
}
|
||||||
str_l += n;
|
str_l += zn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* insert zero padding as requested by the precision or min
|
/* insert zero padding as requested by the precision or min
|
||||||
* field width */
|
* field width */
|
||||||
n = number_of_zeros_to_pad;
|
zn = number_of_zeros_to_pad;
|
||||||
if (n > 0)
|
if (zn > 0)
|
||||||
{
|
{
|
||||||
if (str_l < str_m)
|
if (str_l < str_m)
|
||||||
{
|
{
|
||||||
size_t avail = str_m-str_l;
|
size_t avail = str_m-str_l;
|
||||||
|
|
||||||
vim_memset(str + str_l, '0', n > avail ? avail : n);
|
vim_memset(str + str_l, '0',
|
||||||
|
(size_t)zn > avail ? avail : zn);
|
||||||
}
|
}
|
||||||
str_l += n;
|
str_l += zn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* insert formatted string
|
/* insert formatted string
|
||||||
* (or as-is conversion specifier for unknown conversions) */
|
* (or as-is conversion specifier for unknown conversions) */
|
||||||
{
|
{
|
||||||
int n = str_arg_l - zero_padding_insertion_ind;
|
int sn = str_arg_l - zero_padding_insertion_ind;
|
||||||
|
|
||||||
if (n > 0)
|
if (sn > 0)
|
||||||
{
|
{
|
||||||
if (str_l < str_m)
|
if (str_l < str_m)
|
||||||
{
|
{
|
||||||
@@ -3854,9 +3855,9 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
|||||||
|
|
||||||
mch_memmove(str + str_l,
|
mch_memmove(str + str_l,
|
||||||
str_arg + zero_padding_insertion_ind,
|
str_arg + zero_padding_insertion_ind,
|
||||||
n > avail ? avail : n);
|
(size_t)sn > avail ? avail : sn);
|
||||||
}
|
}
|
||||||
str_l += n;
|
str_l += sn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3864,17 +3865,18 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
|||||||
if (justify_left)
|
if (justify_left)
|
||||||
{
|
{
|
||||||
/* right blank padding to the field width */
|
/* right blank padding to the field width */
|
||||||
int n = min_field_width - (str_arg_l + number_of_zeros_to_pad);
|
int pn = min_field_width - (str_arg_l + number_of_zeros_to_pad);
|
||||||
|
|
||||||
if (n > 0)
|
if (pn > 0)
|
||||||
{
|
{
|
||||||
if (str_l < str_m)
|
if (str_l < str_m)
|
||||||
{
|
{
|
||||||
size_t avail = str_m - str_l;
|
size_t avail = str_m - str_l;
|
||||||
|
|
||||||
vim_memset(str + str_l, ' ', n > avail ? avail : n);
|
vim_memset(str + str_l, ' ',
|
||||||
|
(size_t)pn > avail ? avail : pn);
|
||||||
}
|
}
|
||||||
str_l += n;
|
str_l += pn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -651,12 +651,17 @@ normal_cmd(oap, toplevel)
|
|||||||
buf[0] = c;
|
buf[0] = c;
|
||||||
buf[1] = NUL;
|
buf[1] = NUL;
|
||||||
# endif
|
# endif
|
||||||
/* Fake a "c"hange command.
|
/* Fake a "c"hange command. When "restart_edit" is set (e.g., because
|
||||||
|
* 'insertmode' is set) fake a "d"elete command, Insert mode will
|
||||||
|
* restart automatically.
|
||||||
* Insert the typed character in the typeahead buffer, so that it will
|
* Insert the typed character in the typeahead buffer, so that it will
|
||||||
* be mapped in Insert mode. Required for ":lmap" to work. May cause
|
* be mapped in Insert mode. Required for ":lmap" to work. May cause
|
||||||
* mapping a character from ":vnoremap"... */
|
* mapping a character from ":vnoremap"... */
|
||||||
(void)ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
|
(void)ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
|
||||||
c = 'c';
|
if (restart_edit != 0)
|
||||||
|
c = 'd';
|
||||||
|
else
|
||||||
|
c = 'c';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user