Changeset 1195


Ignore:
Timestamp:
10/10/06 09:15:28 (7 years ago)
Author:
sam
Message:
  • Properly handle \r \n \t in the big and tiny renderers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • toilet/trunk/src/render.c

    r1194 r1195  
    4949static int feed_tiny(context_t *cx, uint32_t ch) 
    5050{ 
     51    switch(ch) 
     52    { 
     53        case (uint32_t)'\r': 
     54            return 0; 
     55        case (uint32_t)'\n': 
     56            cx->x = 0; 
     57            cx->y++; 
     58            return 0; 
     59        case (uint32_t)'\t': 
     60            cx->x = (cx->x & ~7) + 8; 
     61            return 0; 
     62    } 
     63 
    5164    /* Check whether we reached the end of the screen */ 
    5265    if(cx->x && cx->x + 1 > cx->term_width) 
     
    7386    cucul_set_canvas_size(cx->cv, cx->ew, cx->eh); 
    7487 
    75     switch(ch) 
    76     { 
    77         case (uint32_t)'\r': 
    78             return 0; 
    79         case (uint32_t)'\n': 
    80             cx->x = 0; 
    81             cx->y++; 
    82             break; 
    83         case (uint32_t)'\t': 
    84             cx->x = (cx->x & ~7) + 8; 
    85             break; 
    86         default: 
    87             cucul_putchar(cx->cv, cx->x, cx->y, ch); 
    88             cx->x++; 
    89             break; 
    90     } 
     88    cucul_putchar(cx->cv, cx->x, cx->y, ch); 
     89    cx->x++; 
    9190 
    9291    return 0; 
     
    126125    unsigned int h = cucul_get_font_height(cx->f); 
    127126    unsigned int x, y; 
     127 
     128    switch(ch) 
     129    { 
     130        case (uint32_t)'\r': 
     131            return 0; 
     132        case (uint32_t)'\n': 
     133            cx->x = 0; 
     134            cx->y += h; 
     135            return 0; 
     136        case (uint32_t)'\t': 
     137            cx->x = (((cx->x / w) & ~7) + 8) * w; 
     138            return 0; 
     139    } 
    128140 
    129141    /* Check whether we reached the end of the screen */ 
Note: See TracChangeset for help on using the changeset viewer.