character counts instead of byte character counts
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2280
35c25a1d-7b9e-4130-9fde-
d3aeb78583b8
ws2 = (unsigned char)*s2_mb;
}
- if (s1_mb_len > n || towlower(ws1) != towlower(ws2))
+ if (n == 0 || towlower(ws1) != towlower(ws2))
break;
s1 += s1_mb_len;
s2 += s2_mb_len;
- n -= s1_mb_len;
+ n--;
}
free(s1_mb);
#endif
, NULL);
- if (s_mb_len > maxlen)
+ if (maxlen == 0)
break;
- maxlen -= s_mb_len;
+ maxlen--;
n += s_mb_len;
}
free(s_mb);
- return n;
+ return strnlenpt(s, n);
} else
#endif
return
assert(str != NULL);
disp = display_string(str, 0, (COLS / 2) + 1, FALSE);
- numchars = mbstrnlen(disp, actual_x(disp, COLS / 2));
+ numchars = actual_x(disp, mbstrnlen(disp, COLS / 2));
statusbar(_("\"%.*s%s\" not found"), numchars, disp,
(disp[numchars] == '\0') ? "" : "...");