From mlichvar at redhat.com Wed Dec 13 12:06:35 2006 From: mlichvar at redhat.com (Miroslav Lichvar) Date: Tue Jan 30 08:52:12 2007 Subject: [slang-users] SLtt_smart_puts and blank characters Message-ID: <20061213170635.GF643@localhost> Hi, there is a problem in slang with handling blank characters that are in a different color than background. The following example outputs two lines, the first one is terminated correctly, with no trailing spaces, but the second line is not. #include int main() { SLtt_get_terminfo(); SLang_init_tty(-1, 0, 0); SLsmg_init_smg(); SLtt_set_color(0, 0, "red", "blue"); SLtt_set_color(1, 0, "red", "blue"); SLtt_set_color(2, 0, "green", "blue"); SLsmg_set_color(1); SLsmg_write_nstring("abc", 100); SLsmg_set_color(2); SLsmg_gotorc(1, 0); SLsmg_write_nstring("abc", 100); SLsmg_refresh(); SLang_getkey(); SLsmg_reset_smg(); SLang_reset_tty(); return 0; } This patch seems to help. --- sldisply.c.orig +++ sldisply.c @@ -1796,7 +1796,7 @@ #endif /* Find where the last non-blank character on old/new screen is */ - if (CHAR_EQS_SPACE(pmax-1)) + if (((pmax)->wchars[0]==' ') && ((pmax-1)->nchars==1)) { /* If we get here, then we can erase to the end of the line to create * the final space. However, this will only work _if_ erasing will -- Miroslav Lichvar