-
Notifications
You must be signed in to change notification settings - Fork 97
Highlighting using listfocus is wrong for Tamil text #584
Comments
Confirmed with Konsole 17.04.1, Newsbeuter d20cf. STFL 0.22 and 0.24 behave the same. I also ran Newsbeuter with debug logging enabled and it seems like Newsbeuter itself is not confused about the highlighting:
The opening and closing tags are in their proper place. Current hypothesis: STFL is the one to blame. TODO:
If Ncurses version has no problems displaying this, we'll know for sure it's STFL that's at fault. Otherwise we'll have to dig deeper, into Ncurses and beyond. |
While looking through STFL code, the following line from int len = wcswidth(text,wcslen(text));
Diving into this, I wrote a short program that I'm going to present verbatim here: #define _XOPEN_SOURCE
#include <wchar.h>
#include <locale.h>
int main()
{
const wchar_t * text = L"மாத சம்பளம் நன்கொடை: அதிபர் டிரம்ப் அசத்தல்";
setlocale(LC_ALL, "en_US.utf8");
wprintf(L" | . | . | . | . | . |\n");
wprintf(L"String: %ls\n", text);
wprintf(L"Its length is %zi characters.\n", wcslen(text));
wprintf(L"It needs %i columns to be printed out.\n", wcswidth(text, wcslen(text)));
return 0;
} The output in Konsole 17.04.1 looks like this:
The text wasn't chosen on a whim; it's copied from Newsbeuter. Notice that the cutoff in Newsbeuter happens at 35th character: Manpage for TODO:
|
To clarify: I'm not saying the problem is definitely with this particular line; I'm saying the problem is, probably, with |
Tried the same program on FreeBSD 11.0-p9, the result is the same. Had to change "en_US.utf8" to "en_US.UTF-8", otherwise the code is the same. |
Interesting: if I copy the text from the console into the browser, the string takes up 37 columns; not 39 like it does in the terminal:
@j605, are you seeing the same thing in your browser? Who's right, the browser or the terminal? They both use monospaced font, so I don't think they both can be right simultaneously. I found out that locales database is part of libc and maintained by GNU folks. I'm doing a bit more due diligence before filing a bug with them. |
As an aside we don't have a monospace Tamil font, so that is still a problem. The text is taking up 57 columns in my browser. |
Newsbeuter version (copy from
newsbeuter -v
):Steps to reproduce the issue, discussed with @Minoru
Use a Tamil news feed, http://feeds.feedburner.com/dinamalar/Front_page_news
Use a proper terminal emulator(Konsole works best, st works but mangles text) with a Tamil font, for example Noto Sans.
Modify the colorscheme to https://raw.githubusercontent.com/j605/dotfiles/99e2f0f5a25e7f7c1772111efa06109a1e018f1e/newsbeuter/color in order have more pronounced change when the cursor is focused on an unread list item.
Expected outcome
The item is highlighted properly for all languages.
Actual Outcome
Part of the title is coloured and due to the colour scheme used, rest of the text is blocked out for Tamil text:
The behaviour also depends on the Terminal used, in
st
, since the text is not rendered properly (adjacent characters seem to have been merged keeping the length of the rendered text constant across different languages), the highlighting is correct but the text in itself is wrong. Inkonsole
, text is rendered properly but highlighting is wrong.The text was updated successfully, but these errors were encountered: