URI: 
       fix bug in undo list allocation - gramscii - A simple editor for ASCII box-and-arrow charts
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
   DIR commit 62713aaf65264950aecad9237d50e911d7dad893
   DIR parent 08485aacd8d561f2650175b7a16211262396b2ce
  HTML Author: KatolaZ <katolaz@freaknet.org>
       Date:   Thu,  1 Aug 2019 12:19:22 +0100
       
       fix bug in undo list allocation
       
       Diffstat:
         M TODO                                |       2 +-
         M files.c                             |       8 ++++++--
         M gramscii.1                          |       4 ++++
         M gramscii.h                          |       2 +-
         M screen.c                            |       1 +
       
       5 files changed, 13 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/TODO b/TODO
       @@ -1,9 +1,9 @@
        + optimize redraws (redraw only the modified rectangle)
        - fix bug with 'g' commands in arrow mode
       +- fir bug in reading commands from files
        - add screen geometry option (-g 25x80?)
        - read file at point
          - read output of command (!)
       -- use [ENTER] to exit from text insert
        - maybe move "text" mode to "t"
        - implement ellipse
        - (?) filled box (B)
   DIR diff --git a/files.c b/files.c
       @@ -50,8 +50,12 @@ void load_file(FILE *fc){
                get_string(fc, "Load file: ", newfname, 255);
                if ((fin=fopen(newfname, "r")) != NULL){
                        i = 0;
       -                while((fgets(screen.l[i].s, WIDTH+2, fin)) != NULL && i<HEIGHT)
       -                        screen.l[i++].s[WIDTH-1]='\0';
       +                while((fgets(screen.l[i].s, WIDTH+1, fin)) != NULL && i<HEIGHT){
       +                        screen.l[i].lst = strlen(screen.l[i].s) - 1;
       +                        screen.l[i].n = i;
       +                        screen.l[i].s[strlen(screen.l[i].s)-1]='\0';
       +                        i++;
       +                }
                        for(;i<HEIGHT; i++){
                                erase_line(i);
                        }
   DIR diff --git a/gramscii.1 b/gramscii.1
       @@ -557,6 +557,10 @@ would automatically save the screen into "filename".
        gramscii currently manages only a fixed screen of the same size of the
        screen where it starts from. This will be changed in a future release to
        support scrolling and "virtual" screens of any (reasonable) size.
       +.PP
       +There is currently a bug with files read before accepting commands: the
       +result of the commands read from the files is not show immediately, and not
       +shown correctly.
        .SH AUTHORS
        gramscii is written and maintained by Vincenzo "KatolaZ" Nicosia
        <katolaz@freaknet.org>. You can use, copy, modify, and redistribute
   DIR diff --git a/gramscii.h b/gramscii.h
       @@ -82,7 +82,7 @@ typedef struct{
        #define progr_x(d) ((d) == DIR_L ? -1 : (d) == DIR_R ? 1 : 0)
        #define progr_y(d) ((d) == DIR_U ? -1 : (d) == DIR_D ? 1 : 0)
        
       -/** #define DEBUG 1 **/
       +#define DEBUG 1
        
        /** global variables **/ 
        
   DIR diff --git a/screen.c b/screen.c
       @@ -409,6 +409,7 @@ void init_screen(){
                cutbuf.l = NULL;
                cutbuf.num = 0;
                
       +        undo = NULL;
                undo_sz = 0;
                undo_cur = -2;
                undo_lst = -2;