diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c index c8c372b7b..6d34b54d7 100644 --- a/src/editor/editwidget.c +++ b/src/editor/editwidget.c @@ -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'; diff --git a/src/editor/editwidget.h b/src/editor/editwidget.h index 446ef07ac..da0fb508f 100644 --- a/src/editor/editwidget.h +++ b/src/editor/editwidget.h @@ -5,6 +5,8 @@ #ifndef MC__EDIT_WIDGET_H #define MC__EDIT_WIDGET_H +#include /* 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