Changeset 1098


Ignore:
Timestamp:
Sep 23, 2006, 9:07:13 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Fix a bug in the ANSI importer. We need to set the proper fg/bg colours before calling cucul_set_canvas_size(), otherwise it'll fill the new area with the current values.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/import.c

    r962 r1098  
    3434struct ansi_grcm
    3535{
    36     uint8_t fg, bg;
     36    uint8_t fg, bg;   /* ANSI-context fg/bg */
     37    uint8_t efg, ebg; /* Effective (libcucul) fg/bg */
    3738    uint8_t bold, negative, concealed;
    3839};
     
    381382            case 'K': /* EL - Erase In Line */
    382383                if(width < 80)
     384                    cucul_set_color(cv, CUCUL_COLOR_DEFAULT,
     385                                        CUCUL_COLOR_TRANSPARENT);
    383386                    cucul_set_canvas_size(cv, width = 80, height);
    384387                for(j = x; j < 80; j++)
     
    400403         * is big enough. */
    401404        if((unsigned int)x >= width)
     405        {
     406            cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT);
    402407            cucul_set_canvas_size(cv, width = x + 1, height);
     408        }
    403409
    404410        if((unsigned int)y >= height)
     411        {
     412            cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT);
    405413            cucul_set_canvas_size(cv, width, height = y + 1);
     414        }
    406415
    407416        /* Now paste our character */
     417        cucul_set_color(cv, grcm.efg, grcm.ebg);
    408418        cucul_putchar(cv, x, y, cucul_cp437_to_utf32(buffer[i]));
    409419        x++;
     
    427437
    428438    unsigned int j;
    429     uint8_t myfg, mybg;
    430439
    431440    for(j = 0; j < argc; j++)
     
    480489    if(g->concealed)
    481490    {
    482         myfg = mybg = CUCUL_COLOR_TRANSPARENT;
     491        g->efg = g->ebg = CUCUL_COLOR_TRANSPARENT;
    483492    }
    484493    else
    485494    {
    486         myfg = g->negative ? g->bg : g->fg;
    487         mybg = g->negative ? g->fg : g->bg;
     495        g->efg = g->negative ? g->bg : g->fg;
     496        g->ebg = g->negative ? g->fg : g->bg;
    488497
    489498        if(g->bold)
    490499        {
    491             if(myfg < 8)
    492                 myfg += 8;
    493             else if(myfg == CUCUL_COLOR_DEFAULT)
    494                 myfg = CUCUL_COLOR_WHITE;
    495         }
    496     }
    497 
    498     cucul_set_color(cv, myfg, mybg);
     500            if(g->efg < 8)
     501                g->efg += 8;
     502            else if(g->efg == CUCUL_COLOR_DEFAULT)
     503                g->efg = CUCUL_COLOR_WHITE;
     504        }
     505    }
    499506}
    500507
Note: See TracChangeset for help on using the changeset viewer.