diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2017-12-05 02:42:10 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-05 02:42:10 +0100 | 
| commit | 67848c0b916cc1b130bac975017f8e0c762ddc4c (patch) | |
| tree | 9dc091bfc2548cfc9cd481b47e2df1d6e8e333b7 /src/nvim/message.c | |
| parent | a494c999189200c36786f7c453c5c316244da0d1 (diff) | |
| parent | 2d4abc1caedf67487e100f5cef5eca78da68b3e7 (diff) | |
| download | rneovim-67848c0b916cc1b130bac975017f8e0c762ddc4c.tar.gz rneovim-67848c0b916cc1b130bac975017f8e0c762ddc4c.tar.bz2 rneovim-67848c0b916cc1b130bac975017f8e0c762ddc4c.zip | |
Merge #7653 from justinmk/tui-termcap
Diffstat (limited to 'src/nvim/message.c')
| -rw-r--r-- | src/nvim/message.c | 45 | 
1 files changed, 22 insertions, 23 deletions
| diff --git a/src/nvim/message.c b/src/nvim/message.c index b90c475ede..5c8f0655bf 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1237,31 +1237,30 @@ void msg_make(char_u *arg)    }  } -/* - * Output the string 'str' upto a NUL character. - * Return the number of characters it takes on the screen. - * - * If K_SPECIAL is encountered, then it is taken in conjunction with the - * following character and shown as <F1>, <S-Up> etc.  Any other character - * which is not printable shown in <> form. - * If 'from' is TRUE (lhs of a mapping), a space is shown as <Space>. - * If a character is displayed in one of these special ways, is also - * highlighted (its highlight name is '8' in the p_hl variable). - * Otherwise characters are not highlighted. - * This function is used to show mappings, where we want to see how to type - * the character/string -- webb - */ -int -msg_outtrans_special ( -    char_u *strstart, -    int from               /* TRUE for lhs of a mapping */ +/// Output the string 'str' upto a NUL character. +/// Return the number of characters it takes on the screen. +/// +/// If K_SPECIAL is encountered, then it is taken in conjunction with the +/// following character and shown as <F1>, <S-Up> etc.  Any other character +/// which is not printable shown in <> form. +/// If 'from' is TRUE (lhs of a mapping), a space is shown as <Space>. +/// If a character is displayed in one of these special ways, is also +/// highlighted (its highlight name is '8' in the p_hl variable). +/// Otherwise characters are not highlighted. +/// This function is used to show mappings, where we want to see how to type +/// the character/string -- webb +int msg_outtrans_special( +    const char_u *strstart, +    int from               ///< true for LHS of a mapping  )  { -  char_u      *str = strstart; +  if (strstart == NULL) { +    return 0;  // Do nothing. +  } +  const char_u *str = strstart;    int retval = 0; -  int attr; +  int attr = hl_attr(HLF_8); -  attr = hl_attr(HLF_8);    while (*str != NUL) {      const char *string;      // Leading and trailing spaces need to be displayed in <> form. @@ -1307,7 +1306,7 @@ char *str2special_save(const char *const str, const bool replace_spaces,    return (char *)ga.ga_data;  } -/// Convert character, replacing key one key code with printable representation +/// Convert character, replacing key with printable representation.  ///  /// @param[in,out]  sp  String to convert. Is advanced to the next key code.  /// @param[in]  replace_spaces  Convert spaces into <Space>, normally used for @@ -1392,7 +1391,7 @@ void str2specialbuf(const char *sp, char *buf, size_t len)    while (*sp) {      const char *s = str2special(&sp, false, false);      const size_t s_len = strlen(s); -    if (s_len <= len) { +    if (len <= s_len) {        break;      }      memcpy(buf, s, s_len); | 
