mceditor: use MB_LEN_MAX constant.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2021-11-07 12:47:54 +03:00
parent a147082c73
commit 19591c4475
2 changed files with 5 additions and 3 deletions

View File

@ -516,12 +516,12 @@ edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch)
#else
int c;
if (edit->charpoint >= 4)
if (edit->charpoint >= MB_LEN_MAX)
{
edit->charpoint = 0;
edit->charbuf[edit->charpoint] = '\0';
}
if (edit->charpoint < 4)
if (edit->charpoint < MB_LEN_MAX)
{
edit->charbuf[edit->charpoint++] = x_key;
edit->charbuf[edit->charpoint] = '\0';

View File

@ -5,6 +5,8 @@
#ifndef MC__EDIT_WIDGET_H
#define MC__EDIT_WIDGET_H
#include <limits.h> /* MB_LEN_MAX */
#include "lib/search.h" /* mc_search_t */
#include "lib/widget.h" /* Widget */
@ -80,7 +82,7 @@ struct WEdit
/* multibyte support */
gboolean utf8; /* It's multibyte file codeset */
GIConv converter;
char charbuf[4 + 1];
char charbuf[MB_LEN_MAX + 1];
int charpoint;
#endif