Merge remote-tracking branch 'origin/master' into lambda

This commit is contained in:
James McCoy
2017-02-22 17:07:47 -05:00
58 changed files with 2507 additions and 2152 deletions

View File

@@ -1913,17 +1913,13 @@ static int vgetorpeek(int advance)
if ((mp == NULL || max_mlen >= mp_match_len)
&& keylen != KEYLEN_PART_MAP) {
/*
* When no matching mapping found or found a
* non-matching mapping that matches at least what the
* matching mapping matched:
* Check if we have a terminal code, when:
* mapping is allowed,
* keys have not been mapped,
* and not an ESC sequence, not in insert mode or
* p_ek is on,
* and when not timed out,
*/
// When no matching mapping found or found a non-matching mapping
// that matches at least what the matching mapping matched:
// Check if we have a terminal code, when:
// mapping is allowed,
// keys have not been mapped,
// and not an ESC sequence, not in insert mode,
// and when not timed out.
if ((no_mapping == 0 || allow_keys != 0)
&& (typebuf.tb_maplen == 0
|| (p_remap && typebuf.tb_noremap[
@@ -3165,11 +3161,11 @@ map_clear_int (
}
}
/*
* Return characters to represent the map mode in an allocated string.
* Returns NULL when out of memory.
*/
char_u *map_mode_to_chars(int mode)
/// Return characters to represent the map mode in an allocated string
///
/// @return [allocated] NUL-terminated string with characters.
char *map_mode_to_chars(int mode)
FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET
{
garray_T mapmode;
@@ -3202,7 +3198,7 @@ char_u *map_mode_to_chars(int mode)
}
ga_append(&mapmode, NUL);
return (char_u *)mapmode.ga_data;
return (char *)mapmode.ga_data;
}
static void
@@ -3211,8 +3207,7 @@ showmap (
int local /* TRUE for buffer-local map */
)
{
int len = 1;
char_u *mapchars;
size_t len = 1;
if (msg_didout || msg_silent != 0) {
msg_putchar('\n');
@@ -3220,29 +3215,30 @@ showmap (
return;
}
mapchars = map_mode_to_chars(mp->m_mode);
if (mapchars != NULL) {
{
char *const mapchars = map_mode_to_chars(mp->m_mode);
msg_puts(mapchars);
len = (int)STRLEN(mapchars);
len = strlen(mapchars);
xfree(mapchars);
}
while (++len <= 3)
msg_putchar(' ');
/* Display the LHS. Get length of what we write. */
len = msg_outtrans_special(mp->m_keys, TRUE);
// Display the LHS. Get length of what we write.
len = (size_t)msg_outtrans_special(mp->m_keys, true);
do {
msg_putchar(' '); /* padd with blanks */
++len;
} while (len < 12);
if (mp->m_noremap == REMAP_NONE)
msg_puts_attr((char_u *)"*", hl_attr(HLF_8));
else if (mp->m_noremap == REMAP_SCRIPT)
msg_puts_attr((char_u *)"&", hl_attr(HLF_8));
else
if (mp->m_noremap == REMAP_NONE) {
msg_puts_attr("*", hl_attr(HLF_8));
} else if (mp->m_noremap == REMAP_SCRIPT) {
msg_puts_attr("&", hl_attr(HLF_8));
} else {
msg_putchar(' ');
}
if (local)
msg_putchar('@');
@@ -3251,11 +3247,11 @@ showmap (
/* Use FALSE below if we only want things like <Up> to show up as such on
* the rhs, and not M-x etc, TRUE gets both -- webb */
if (*mp->m_str == NUL)
msg_puts_attr((char_u *)"<Nop>", hl_attr(HLF_8));
else {
/* Remove escaping of CSI, because "m_str" is in a format to be used
* as typeahead. */
if (*mp->m_str == NUL) {
msg_puts_attr("<Nop>", hl_attr(HLF_8));
} else {
// Remove escaping of CSI, because "m_str" is in a format to be used
// as typeahead.
char_u *s = vim_strsave(mp->m_str);
vim_unescape_csi(s);
msg_outtrans_special(s, FALSE);