vim-patch:7.4.2099 (#5951)

Problem:    When a keymap is active only "(lang)" is displayed. (Ilya
            Dogolazky)
Solution:   Show the keymap name. (Dmitri Vereshchagin, closes vim/vim#933)

73ac0c4281
This commit is contained in:
Shougo 2017-01-16 06:24:12 +09:00 committed by Justin M. Keyes
parent b5560a69b1
commit 3fd7be6d3e
3 changed files with 13 additions and 11 deletions

View File

@ -3443,7 +3443,7 @@ int build_stl_str_hl(
case STL_KEYMAP: case STL_KEYMAP:
fillable = false; fillable = false;
if (get_keymap_str(wp, tmp, TMPLEN)) if (get_keymap_str(wp, (char_u *)"<%s>", tmp, TMPLEN))
str = tmp; str = tmp;
break; break;
case STL_PAGENUM: case STL_PAGENUM:

View File

@ -4912,7 +4912,7 @@ void win_redr_status(win_T *wp)
screen_fill(row, row + 1, len + wp->w_wincol, screen_fill(row, row + 1, len + wp->w_wincol,
this_ru_col + wp->w_wincol, fillchar, fillchar, attr); this_ru_col + wp->w_wincol, fillchar, fillchar, attr);
if (get_keymap_str(wp, NameBuff, MAXPATHL) if (get_keymap_str(wp, (char_u *)"<%s>", NameBuff, MAXPATHL)
&& this_ru_col - len > (int)(STRLEN(NameBuff) + 1)) && this_ru_col - len > (int)(STRLEN(NameBuff) + 1))
screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff) screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff)
- 1 + wp->w_wincol), attr); - 1 + wp->w_wincol), attr);
@ -4993,8 +4993,9 @@ int stl_connected(win_T *wp)
int int
get_keymap_str ( get_keymap_str (
win_T *wp, win_T *wp,
char_u *buf, /* buffer for the result */ char_u *fmt, // format string containing one %s item
int len /* length of buffer */ char_u *buf, // buffer for the result
int len // length of buffer
) )
{ {
char_u *p; char_u *p;
@ -5021,10 +5022,9 @@ get_keymap_str (
else else
p = (char_u *)"lang"; p = (char_u *)"lang";
} }
if ((int)(STRLEN(p) + 3) < len) if (vim_snprintf((char *)buf, len, (char *)fmt, p) > len - 1) {
sprintf((char *)buf, "<%s>", p);
else
buf[0] = NUL; buf[0] = NUL;
}
xfree(s); xfree(s);
} }
return buf[0] != NUL; return buf[0] != NUL;
@ -6752,10 +6752,12 @@ int showmode(void)
if (p_fkmap) if (p_fkmap)
MSG_PUTS_ATTR(farsi_text_5, attr); MSG_PUTS_ATTR(farsi_text_5, attr);
if (State & LANGMAP) { if (State & LANGMAP) {
if (curwin->w_p_arab) if (curwin->w_p_arab) {
MSG_PUTS_ATTR(_(" Arabic"), attr); MSG_PUTS_ATTR(_(" Arabic"), attr);
else } else if (get_keymap_str(curwin, (char_u *)" (%s)",
MSG_PUTS_ATTR(_(" (lang)"), attr); NameBuff, MAXPATHL)) {
MSG_PUTS_ATTR(NameBuff, attr);
}
} }
if ((State & INSERT) && p_paste) if ((State & INSERT) && p_paste)
MSG_PUTS_ATTR(_(" (paste)"), attr); MSG_PUTS_ATTR(_(" (paste)"), attr);

View File

@ -341,7 +341,7 @@ static int included_patches[] = {
// 2102 NA // 2102 NA
// 2101, // 2101,
2100, 2100,
// 2099, 2099,
// 2098, // 2098,
// 2097, // 2097,
// 2096, // 2096,