Re: yet another utf8 patch: fix completion
- From: Egmont Koblinger <egmont uhulinux hu>
- To: Jindrich Novy <jnovy redhat com>
- Cc: mc-devel gnome org
- Subject: Re: yet another utf8 patch: fix completion
- Date: Thu, 4 Jan 2007 12:28:10 +0100
Hi,
> Just a question related to 00-84-utf8-complete.patch. Why do you replace
> "if (SLsmg_Is_Unicode)" with "if (1)" in the implementation of
> mbstrnlen() ?
I just applied the previous patches and then cloned mbstrnlen() from
mbstrlen(). This modification comes from patch nr. 00-75. As far as I
remember, mc processes the "--help" switch before initializing slang, but we
already need a properly working mbstrlen() here to have the 2nd column of
the row "+number" displayed in the right place, if the translation of the
string "+number" contains accents. (The least important issue any of these
utf8 patches addresses :-)) Since mbstrnlen() is not used at this time, it's
perfectly okay to have "if (SLsmg_Is_Unicode)" there. Probably a better
approach would be to initialize slang at the very start and have both
functions begin with "if (SLsmg_Is_Unicode)".
> Will it work when mc is compiled with UTF-8 patches and
> ran with non-UTF-8 locale?
I guess it will, but I haven't tested. IIRC I once tested it with --help and
it worked. I think mbrtowc() and friends work correctly when converting
between arbitrary non-UTF-8 locale and wchar. ... OK, now I did a quick test
of tab completion in latin2 and it seems to work correctly.
Please note that I also modify mbstrlen() in patch nr. 00-82, and this one
also affects my implementation of mbstrnlen().
By the way, it seemed to me that we wouldn't need mbstrnlen(), since when we
call it, we actually always pass it the actual length of the string. If it
is the case, a simple mbstrlen() would have done it; but I just couldn't get
sure this is the case; and I didn't want to use a different approach than
the original code did.
--
Egmont
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]