pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/60844: www/lynx with NetBSD curses fails to display utf-8



The following reply was made to PR pkg/60844; it has been noted by GNATS.

From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/60844: www/lynx with NetBSD curses fails to display utf-8
Date: Sat, 3 Oct 2026 14:23:58 +0300

 --- a/src/LYCurses.c
 +++ b/src/LYCurses.c
 @@ -2287,19 +2287,31 @@ void LYwaddnstr(WINDOW * w GCC_UNUSED,
  #endif
      LYGetYX(y0, x0);
  
 -    for (inx = 0; inx < len; ++inx) {
 -	/*
 -	 * Do tab-expansion relative to the base of the string (rather than
 -	 * the screen) so that tabs in a TEXTAREA will look right.
 -	 */
 -	if (src[inx] == '\t') {
 -	    LYGetYX(y, x);
 -	    while ((++x - x0) % 8)
 -		waddch(w, ' ');
 -	    waddch(w, ' ');
 -	} else {
 -	    waddch(w, UCH(src[inx]));
 +    /*
 +     * waddnstr(w, src, len), but do tab-expansion relative to the
 +     * base of the string (rather than the screen) so that tabs in a
 +     * TEXTAREA will look right.
 +     */
 +    const char *chunk = src;
 +    while (*chunk != '\0') {
 +	const char *tabp = strchr(chunk, '\t');
 +	if (tabp == NULL) {
 + 	    size_t toend = src + len - chunk;
 +	    waddnstr(w, chunk, toend);
 +	    break;
  	}
 +
 +	if (tabp != chunk) {
 + 	    size_t totab = tabp - chunk;
 +	    waddnstr(w, chunk, totab);
 +	}
 +
 +	LYGetYX(y, x);
 +	do {
 +	    waddch(w, ' ');
 +	} while ((++x - x0) % 8);
 +
 +	chunk = tabp + 1;
      }
  }
  
 ----8<--------8<--------8<----
 begin 644 LYwaddnstr.patch
 M+2TM(&$O<W)C+TQ90W5R<V5S+F,**RLK(&(O<W)C+TQ90W5R<V5S+F,*0$`@
 M+3(R.#<L,3D@*S(R.#<L,S$@0$`@=F]I9"!,67=A9&1N<W1R*%=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7T**PHK"6EF("AT86)P("$](&-H
 M=6YK*2!["BL@"2`@("!S:7IE7W0@=&]T86(@/2!T86)P("T@8VAU;FL["BL)
 M("`@('=A9&1N<W1R*'<L(&-H=6YK+"!T;W1A8BD["BL)?0HK"BL)3%E'9719
 M6"AY+"!X*3L**PED;R!["BL)("`@('=A9&1C:"AW+"`G("<I.PHK"7T@=VAI
 M;&4@*"@K*W@@+2!X,"D@)2`X*3L**PHK"6-H=6YK(#T@=&%B<"`K(#$["B`@
 *("`@?0H@?0H@"@``
 `
 end
 
 -uwe
 



Home | Main Index | Thread Index | Old Index