tMerge branch 'master' of git://bitreich.org/sacc - sacc - [fork] customized build of sacc, the simple console gopher client
 (HTM) git clone git://src.adamsgaard.dk/sacc
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 7357ad79b8d43834396c672d632506c18c0952fb
 (DIR) parent 1aeb110cd8997892b0579c54cf8ac064caa36b2f
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Wed,  6 Jan 2021 09:13:08 +0100
       
       Merge branch 'master' of git://bitreich.org/sacc
       
       Diffstat:
         M sacc.1                              |       6 ++++++
         M sacc.c                              |      12 +++++++++---
         M ui_ti.c                             |      12 ++++--------
       
       3 files changed, 19 insertions(+), 11 deletions(-)
       ---
 (DIR) diff --git a/sacc.1 b/sacc.1
       t@@ -75,6 +75,12 @@ Show the help message of shortcuts.
        .TP
        .B ^D or q
        Exit sacc.
       +.SH ENVIRONMENT
       +Sacc will use the pager set in the
       +.B PAGER
       +variable to display textual content.
       +Note that sacc takes back control of the screen
       +as soon as the pager finishes.
        .SH PLUMBER
        When some file is opened
        .I sacc
 (DIR) diff --git a/sacc.c b/sacc.c
       t@@ -110,12 +110,18 @@ mbsprint(const char *s, size_t len)
        
                slen = strlen(s);
                for (i = 0; i < slen; i += rl) {
       -                if ((rl = mbtowc(&wc, s + i, slen - i < 4 ? slen - i : 4)) <= 0)
       -                        break;
       +                rl = mbtowc(&wc, s + i, slen - i < 4 ? slen - i : 4);
       +                if (rl == -1) {
       +                        mbtowc(NULL, NULL, 0); /* reset state */
       +                        fputs("\xef\xbf\xbd", stdout); /* replacement character */
       +                        col++;
       +                        rl = 1;
       +                        continue;
       +                }
                        if ((w = wcwidth(wc)) == -1)
                                continue;
                        if (col + w > len || (col + w == len && s[i + rl])) {
       -                        fputs("\xe2\x80\xa6", stdout);
       +                        fputs("\xe2\x80\xa6", stdout); /* ellipsis */
                                col++;
                                break;
                        }
 (DIR) diff --git a/ui_ti.c b/ui_ti.c
       t@@ -66,8 +66,7 @@ uiprompt(char *fmt, ...)
                n = mbsprint(bufout, columns);
        
                putp(tparm(exit_standout_mode, 0, 0, 0, 0, 0, 0, 0, 0, 0));
       -        if (n < columns)
       -                printf("%*s", columns - n, " ");
       +        putp(tparm(clr_eol, 0, 0, 0, 0, 0, 0, 0, 0, 0));
        
                putp(tparm(cursor_address, lines-1, n, 0, 0, 0, 0, 0, 0, 0));
        
       t@@ -159,8 +158,7 @@ uistatus(char *fmt, ...)
        
                n = mbsprint(bufout, columns);
                putp(tparm(exit_standout_mode, 0, 0, 0, 0, 0, 0, 0, 0, 0));
       -        if (n < columns)
       -                printf("%*s", columns - n, " ");
       +        putp(tparm(clr_eol, 0, 0, 0, 0, 0, 0, 0, 0, 0));
        
                putp(tparm(restore_cursor, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                fflush(stdout);
       t@@ -190,8 +188,7 @@ displaystatus(Item *item)
                        bufout[sizeof(bufout)-1] = '\0';
                n = mbsprint(bufout, columns);
                putp(tparm(exit_standout_mode, 0, 0, 0, 0, 0, 0, 0, 0, 0));
       -        if (n < columns)
       -                printf("%*s", columns - n, " ");
       +        putp(tparm(clr_eol, 0, 0, 0, 0, 0, 0, 0, 0, 0));
        
                putp(tparm(restore_cursor, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                fflush(stdout);
       t@@ -253,8 +250,7 @@ displayuri(Item *item)
                itemuri(item);
                n = mbsprint(bufout, columns);
                putp(tparm(exit_standout_mode, 0, 0, 0, 0, 0, 0, 0, 0, 0));
       -        if (n < columns)
       -                printf("%*s", columns - n, " ");
       +        putp(tparm(clr_eol, 0, 0, 0, 0, 0, 0, 0, 0, 0));
        
                putp(tparm(restore_cursor, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                fflush(stdout);