Re: [dev] [st] Rendering only half of emoji in curses-based program

From: Steffen Nurpmeso <steffen_AT_sdaoden.eu>
Date: Mon, 31 Mar 2025 22:56:40 +0200

Andrej Nabergoj wrote in
 <20250331180240.cxujdddus55yqzqn_AT_debian.si>:
 |wcwidth(L"😍") gives me 2 if you meant this. I tried on another laptop
 |(but it has debian installed too) and problem was the same.
 |If I print any character that has wcwidth() = 2 to the third last place
 |of terminal, only half of the character is rendered. This only happens
 |if using curses. I'v tried it on debian and on another fedora laptop.
 |```
 |#include <curses.h>
 |#include <locale.h>
 |
 |int main() {
 | int last_row = 5, last_column = 25;
 | setlocale(LC_ALL, "");
 | initscr();
 | mvaddstr(last_row, last_column-2, "字");
 | getch();
 | endwin();
 | return 0;
 |}
 |```
 |Thank you for trying to reproduce it.

Note i have no idea and did not truly look into the issue, but
there is a problem with terminals and the lowermost, rightmost
cell. Ie i have, which names termcap/terminfo capabilities

        mx_TERMCAP_QUERY_am, /* am/am, BOOL | auto_right_margin */
        mx_TERMCAP_QUERY_sam, /* sam/YE, BOOL | semi_auto_right_margin */
        mx_TERMCAP_QUERY_xenl, /* xenl/xn, BOOL | eat_newline_glitch */

But i am (the mailer i maintain, at least, does) not doing this
completely right, as can be done.
However, most programs either do not use the lowermost/rightmost
column to avoid cursor wrap if written there, or otherwise deal
with those capabilities.
I have zero idea on what st does though.

Hope that helps.

 |Andrej
 |
 |On 30/03/25 05:33, Eric Pruitt wrote:
 |> On Sun, Mar 30, 2025 at 07:32:14PM +0200, Andrej Nabergoj wrote:
 |>> The program is so small I don't need github, I apologise.
 |>> If you make st window 1 row high and 9 columns wide, so string
 |>> "😍😍😍😍x" should fill whole window, last emoji gets cut on half.
 |>
 |> I can't reproduce this. What does wcwidth(3) return for the emoji?
 |>
 |> Eric
 |>
 |> PS: Sender BCC'd because I have delivery issues with the suckless
 |> mailing lists.
 |
 --End of <20250331180240.cxujdddus55yqzqn_AT_debian.si>

--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
Received on Mon Mar 31 2025 - 22:56:40 CEST

This archive was generated by hypermail 2.3.0 : Mon Mar 31 2025 - 23:00:10 CEST