X-Git-Url: https://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/blobdiff_plain/0f52205ee0e300b66896d8fd0355189763b22586..af5785e07229ef8c6add194f305ad5962dd2cd62:/contrib/libedit/src/eln.c diff --git a/contrib/libedit/src/eln.c b/contrib/libedit/src/eln.c index 5bcfb4f2b3..a5c9fa7d9a 100644 --- a/contrib/libedit/src/eln.c +++ b/contrib/libedit/src/eln.c @@ -75,10 +75,18 @@ public const char * el_gets(EditLine *el, int *nread) { const wchar_t *tmp; + int nwread; + + *nread = 0; + + if (!(el->el_flags & CHARSET_IS_UTF8)) + el->el_flags |= IGNORE_EXTCHARS; + tmp = el_wgets(el, &nwread); + if (!(el->el_flags & CHARSET_IS_UTF8)) + el->el_flags &= ~IGNORE_EXTCHARS; + for (int i = 0; i < nwread; i++) + *nread += ct_enc_width(tmp[i]); - el->el_flags |= IGNORE_EXTCHARS; - tmp = el_wgets(el, nread); - el->el_flags &= ~IGNORE_EXTCHARS; return ct_encode_string(tmp, &el->el_lgcyconv); }