Skip to content

Commit 73ac0c4

Browse files
committed
patch 7.4.2099
Problem: When a keymap is active only "(lang)" is displayed. (Ilya Dogolazky) Solution: Show the keymap name. (Dmitri Vereshchagin, closes #933)
1 parent 6f1d9a0 commit 73ac0c4

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4114,7 +4114,7 @@ build_stl_str_hl(
41144114

41154115
case STL_KEYMAP:
41164116
fillable = FALSE;
4117-
if (get_keymap_str(wp, tmp, TMPLEN))
4117+
if (get_keymap_str(wp, (char_u *)"<%s>", tmp, TMPLEN))
41184118
str = tmp;
41194119
break;
41204120
case STL_PAGENUM:

src/proto/screen.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void win_redraw_last_status(frame_T *frp);
2323
void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, int match, int showtail);
2424
void win_redr_status(win_T *wp);
2525
int stl_connected(win_T *wp);
26-
int get_keymap_str(win_T *wp, char_u *buf, int len);
26+
int get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len);
2727
void screen_putchar(int c, int row, int col, int attr);
2828
void screen_getbytes(int row, int col, char_u *bytes, int *attrp);
2929
void screen_puts(char_u *text, int row, int col, int attr);

src/screen.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6767,7 +6767,7 @@ win_redr_status(win_T *wp)
67676767
screen_fill(row, row + 1, len + W_WINCOL(wp),
67686768
this_ru_col + W_WINCOL(wp), fillchar, fillchar, attr);
67696769

6770-
if (get_keymap_str(wp, NameBuff, MAXPATHL)
6770+
if (get_keymap_str(wp, (char_u *)"<%s>", NameBuff, MAXPATHL)
67716771
&& (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1))
67726772
screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff)
67736773
- 1 + W_WINCOL(wp)), attr);
@@ -6862,6 +6862,7 @@ stl_connected(win_T *wp)
68626862
int
68636863
get_keymap_str(
68646864
win_T *wp,
6865+
char_u *fmt, /* format string containing one %s item */
68656866
char_u *buf, /* buffer for the result */
68666867
int len) /* length of buffer */
68676868
{
@@ -6894,9 +6895,7 @@ get_keymap_str(
68946895
#endif
68956896
p = (char_u *)"lang";
68966897
}
6897-
if ((int)(STRLEN(p) + 3) < len)
6898-
sprintf((char *)buf, "<%s>", p);
6899-
else
6898+
if (vim_snprintf((char *)buf, len, (char *)fmt, p) > len - 1)
69006899
buf[0] = NUL;
69016900
#ifdef FEAT_EVAL
69026901
vim_free(s);
@@ -10166,7 +10165,9 @@ showmode(void)
1016610165
MSG_PUTS_ATTR(_(" Arabic"), attr);
1016710166
else
1016810167
# endif
10169-
MSG_PUTS_ATTR(_(" (lang)"), attr);
10168+
if (get_keymap_str(curwin, (char_u *)" (%s)",
10169+
NameBuff, MAXPATHL))
10170+
MSG_PUTS_ATTR(NameBuff, attr);
1017010171
}
1017110172
#endif
1017210173
if ((State & INSERT) && p_paste)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ static char *(features[]) =
758758

759759
static int included_patches[] =
760760
{ /* Add new patch number below this line */
761+
/**/
762+
2099,
761763
/**/
762764
2098,
763765
/**/

0 commit comments

Comments
 (0)