]> git.neil.brown.name Git - edlib.git/commitdiff
Use ->extra instead of ->str[0] to pass a wide-char to pane-text
authorNeilBrown <neil@brown.name>
Sun, 15 Nov 2015 23:50:04 +0000 (10:50 +1100)
committerNeilBrown <neil@brown.name>
Sun, 15 Nov 2015 23:50:04 +0000 (10:50 +1100)
after all, a wch_t doesn't fit in a char.

Signed-off-by: NeilBrown <neil@brown.name>
core-pane.c
display-ncurses.c

index e28598b3b6631ff69b0bf590dfbf39f66ef69864..3e01f24ee6ba256043bbfa4d9cab1f8c9ad7ebee 100644 (file)
@@ -480,9 +480,8 @@ void pane_text(struct pane *p, wchar_t ch, char *attrs, int x, int y)
        ci.y = y;
        ci.str = buf;
        ci.str2 = attrs;
-       /* FIXME wchar! */
-       buf[0] = ch;
-       buf[1] = 0;
+       ci.extra = ch;
+
        /* FIXME this could result in cropping the text. */
        key_handle_xy(&ci);
 }
index 580ff429aae97e02d7bbcfe9b50b3d1779b5f899..952a6c2d916dfa2d5dd6b683da589579dc48db62 100644 (file)
@@ -149,7 +149,7 @@ DEF_CMD(ncurses_handle)
        }
        if (strcmp(ci->key, "pane-text") == 0) {
                int attr = cvt_attrs(ci->str2);
-               ncurses_text(ci->home, ci->str[0], attr, ci->x, ci->y);
+               ncurses_text(ci->home, ci->extra, attr, ci->x, ci->y);
                return 1;
        }
        if (strcmp(ci->key, "Refresh") == 0) {
@@ -250,16 +250,12 @@ static void ncurses_clear(struct pane *p, int attr, int x, int y, int w, int h)
 static void ncurses_text(struct pane *p, wchar_t ch, int attr, int x, int y)
 {
        struct display_data *dd;
-       cchar_t cc;
+       cchar_t cc = {0};
 
        dd = p->data;
        set_screen(dd->scr);
        cc.attr = attr;
        cc.chars[0] = ch;
-       cc.chars[1] = 0;
-       #ifdef NCURSES_EXT_COLORS
-       cc.ext_color = 0;
-       #endif
 
        mvadd_wch(y, x, &cc);
 }