return 10;
}
+/* combining mark / non-spacing character */
+#define COMB_CHAR(wc) (IsWPrint (wc) && !wcwidth (wc))
+
static int my_wcswidth (const wchar_t *s, size_t n)
{
int w = 0;
else
{
i = state->curpos;
- while (i && !wcwidth (state->wbuf[i - 1]))
+ while (i && COMB_CHAR (state->wbuf[i - 1]))
--i;
if (i)
--i;
BEEP ();
else
{
- while (state->curpos && !wcwidth (state->wbuf[state->curpos - 1]))
+ while (state->curpos && COMB_CHAR (state->wbuf[state->curpos - 1]))
state->curpos--;
if (state->curpos)
state->curpos--;
else
{
++state->curpos;
- while (state->curpos < state->lastchar && !wcwidth (state->wbuf[state->curpos]))
+ while (state->curpos < state->lastchar && COMB_CHAR (state->wbuf[state->curpos]))
++state->curpos;
}
break;
else
{
i = state->curpos;
- while (i < state->lastchar && !wcwidth (state->wbuf[i]))
+ while (i < state->lastchar && COMB_CHAR (state->wbuf[i]))
++i;
if (i < state->lastchar)
++i;
- while (i < state->lastchar && !wcwidth (state->wbuf[i]))
+ while (i < state->lastchar && COMB_CHAR (state->wbuf[i]))
++i;
memmove (state->wbuf + state->curpos, state->wbuf + i, (state->lastchar - i) * sizeof (wchar_t));
state->lastchar -= i - state->curpos;
if (!charset_is_ja)
{
/* 8-bit case */
- if (0 <= wc && wc < 256)
- return IsPrint (wc) ? 1 : -1;
+ if (!wc)
+ return 0;
+ else if ((0 <= wc && wc < 256) && IsPrint (wc))
+ return 1;
else
return -1;
}