add '.' command (reset line styles) - gramscii - A simple editor for ASCII box-and-arrow charts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 130977d60200ae44ca6e27474a3127d1e8cd34b7
 (DIR) parent 591777d6f9f064b5a3800ba656837b200c41b524
 (HTM) Author: KatolaZ <katolaz@freaknet.org>
       Date:   Sat, 20 Jul 2019 18:30:48 +0100
       
       add '.' command (reset line styles)
       
       Diffstat:
         M gramscii.c                          |      26 +++++++++++++++++---------
       
       1 file changed, 17 insertions(+), 9 deletions(-)
       ---
 (DIR) diff --git a/gramscii.c b/gramscii.c
       @@ -121,7 +121,7 @@ void status_bar(){
                printf("\033[%d;1f\033[7m", HEIGHT+1);
                printf("%100s", " ");
                printf("\033[%d;1f\033[7m", HEIGHT+1);
       -        printf(" x:%3d y:%3d -- MODE:%4s HL:%c VL:%c CN:%c SM:%c EM:%c %10s",
       +        printf(" x:%3d y:%3d -- MODE:%4s HL:%c VL:%c CN:%c SP:%c EP:%c %10s",
                        x, y, state_str(), line_h, line_v, corner, mark_st, mark_end, "");
                if (!modified)
                        printf(" [%s]", fname );
       @@ -220,12 +220,8 @@ void check_bound(){
                else if (y>=HEIGHT) y = HEIGHT -1;
        }
        
       -void init_screen(){
       -        int i;
       -        for(i=0; i<HEIGHT; i++){
       -                memset(screen[i], ' ', WIDTH);
       -                screen[i][WIDTH]='\0';
       -        }
       +void reset_styles(){
       +
                cur_corn = 0;
                corner = corners[0];
                cur_hl = cur_vl = 0;
       @@ -234,6 +230,16 @@ void init_screen(){
                line_v = vlines[cur_vl];
                mark_st = st_marks[cur_start];
                mark_end = end_marks[cur_end];
       +
       +}
       +
       +void init_screen(){
       +        int i;
       +        for(i=0; i<HEIGHT; i++){
       +                memset(screen[i], ' ', WIDTH);
       +                screen[i][WIDTH]='\0';
       +        }
       +        reset_styles();
        }
        
        void redraw(){
       @@ -356,7 +362,6 @@ void toggle_end_mark(){
        
        
        
       -
        /*****  text, box, arrows  *****/
        
        void get_text(){
       @@ -699,7 +704,7 @@ void commands(){
                                        state = TEXT;
                                        get_text();
                                        break;
       -                        case 'r':
       +                        case 'R':
                                        redraw();
                                        break;
                                case 'b':
       @@ -746,6 +751,9 @@ void commands(){
                                case '>':
                                        toggle_end_mark();
                                        break;
       +                        case '.':
       +                                reset_styles();
       +                                break;
                                case 'q':
                                        check_modified();/** FALLTHROUGH **/
                                case 'Q':