Re: yet another utf8 patch: fix completion
Hi Egmont, On Tue, 2007-01-02 at 18:14 +0100, Egmont Koblinger wrote: Hi, Especially to the maintainers of the UTF-8 patches: I've created another patch, this time to fix Alt+Tab (or Escape then TAB) completion when the command line or filename or whatever you type already contains some accented characters. The problem is caused by the UI widget telling the cursor position in characters, while the functions in complete.c expect them to refer to bytes. This new patch can be found at the usual places: https://svn.uhulinux.hu/packages/2.0/mc/patches/ https://svn.uhulinux.hu/packages/dev/mc/patches/ and is called 00-84-utf8-complete.patch. As usual, unfortunately, length and width are not clearly distinguished, so it's unlikely to work correctly with double-width characters. To be applied on the top of the previous utf8 patches in numerical order (though it doesn't depend on all of them). 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() ? Will it work when mc is compiled with UTF-8 patches and ran with non-UTF-8 locale? Thanks, Jindrich ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: yet another utf8 patch: fix completion
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 ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
yet another utf8 patch: fix completion
Hi, Especially to the maintainers of the UTF-8 patches: I've created another patch, this time to fix Alt+Tab (or Escape then TAB) completion when the command line or filename or whatever you type already contains some accented characters. The problem is caused by the UI widget telling the cursor position in characters, while the functions in complete.c expect them to refer to bytes. This new patch can be found at the usual places: https://svn.uhulinux.hu/packages/2.0/mc/patches/ https://svn.uhulinux.hu/packages/dev/mc/patches/ and is called 00-84-utf8-complete.patch. As usual, unfortunately, length and width are not clearly distinguished, so it's unlikely to work correctly with double-width characters. To be applied on the top of the previous utf8 patches in numerical order (though it doesn't depend on all of them). The 2.0 directory contains patches of the UHU-Linux 2.0 distribution, which is already released. This means that contents of this directory is hardly changing (though I've just put this patch here and released an update package). These patches apply to mainstream mc 4.6.1 release and will never be ported to newer versions of mc. The dev directory contains the patches of our current development version. Currently there's only one small difference (one extra utf8 patch here) but the contents of this directory is more likely to change at any time. (Check for the file ../version to see which mc version these patches apply to if you're reading this letter much later than I send it.) bye, Egmont ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel