slang-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] SLtt_smart_puts and blank characters


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 <slang/slang.h>
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

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]