My suggestion is to avoid the featureless, buggy, uncommented 'st' garbage code 
and use a real terminal emulator, like rxvt or xterm. 

Dave

On Tue, 1 Apr 2025 23:06:26 +0200
Andrej Nabergoj <andrej.naber...@siol.net> wrote:

> The problem is not with lowermost, rightmost cell but one that is
> two positions before rightmost, lowermost cell.
> I looked at tputc() function, but I don't know yet how to use these
> debugging tools.
> If I comment this two lines for example it renders whole character, but
> of course this is not a solution:
> if (width == 2) {
>     /* gp->mode |= ATTR_WIDE; */
>     if (term.c.x+1 < term.col) {
>         if (gp[1].mode == ATTR_WIDE && term.c.x+2 < term.col) {
>             gp[2].u = ' ';
>             gp[2].mode &= ~ATTR_WDUMMY;
>         }
>         gp[1].u = '\0';
>         /* gp[1].mode = ATTR_WDUMMY; */
>     }
> }
> 
> #include <curses.h>
> #include <locale.h>
> int main() {
>     int row, col;
>     setlocale(LC_ALL, "");
>     initscr();
>     getmaxyx(stdscr, row, col);
>     mvprintw(row-1, col-3, "字");
>     getch();
>     endwin();
>     return 0;
> }
> 
> I will try to learn how to use gdb and give it another try when I have
> time.
> 
> Thank you to both.
> Regrads,
> Andrej
> 
> On 01/04/25 09:05, Roberto E. Vargas Caballero wrote:
> > Quoth Steffen Nurpmeso <stef...@sdaoden.eu>:
> > > 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
> > 
> > These capabilities are about when the terminal does wrapping. VT100
> > alike terminals do wrapping when you write past the last column.
> > It means that when you write the last column the cursor stays in the
> > last column and it does not moves to the  next line. St behaves
> > like this.
> > 
> > All the logic about wide chars is in the function tputc() in st.c.
> > You can try run st from gdb, write in st until you arrive to that
> > column, then set a breakpoint in tputc() using gdb and see what
> > happens when you write that character. It is likely that some
> > miscalculation is done.
> > 
> > Regards,
> > 
> > 
> 

Reply via email to