diff src/macros.h @ 24055:90d1636a8fcb v8.2.2569

patch 8.2.2569: 'fillchars' "stl" and "stlnc" items must be single byte Commit: https://github.com/vim/vim/commit/008bff967f7fcaa6af066f71d65bfbba5ef5c7d3 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 4 21:55:58 2021 +0100 patch 8.2.2569: 'fillchars' "stl" and "stlnc" items must be single byte Problem: 'fillchars' "stl" and "stlnc" items must be single byte. Solution: Accept multi-byte characters. (Christian Wellenbrock, Yegappan Lakshmanan, closes #7927)
author Bram Moolenaar <Bram@vim.org>
date Thu, 04 Mar 2021 22:00:04 +0100
parents 15408ab5fed7
children 7334bf933510
line wrap: on
line diff
--- a/src/macros.h
+++ b/src/macros.h
@@ -252,6 +252,7 @@
 #define MB_CHARLEN(p)	    (has_mbyte ? mb_charlen(p) : (int)STRLEN(p))
 #define MB_CHAR2LEN(c)	    (has_mbyte ? mb_char2len(c) : 1)
 #define PTR2CHAR(p)	    (has_mbyte ? mb_ptr2char(p) : (int)*(p))
+#define MB_CHAR2BYTES(c, b) do { if (has_mbyte) (b) += (*mb_char2bytes)((c), (b)); else *(b)++ = (c); } while(0)
 
 #ifdef FEAT_AUTOCHDIR
 # define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0)