summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2019-08-01 12:19:22 +0100
committerKatolaZ <katolaz@freaknet.org>2019-08-01 12:19:22 +0100
commit62713aaf65264950aecad9237d50e911d7dad893 (patch)
tree5d91079a8d70ae734564ec2dd5e00b107d0d589f
parent08485aacd8d561f2650175b7a16211262396b2ce (diff)
fix bug in undo list allocation
-rw-r--r--TODO2
-rw-r--r--files.c8
-rw-r--r--gramscii.14
-rw-r--r--gramscii.h2
-rw-r--r--screen.c1
5 files changed, 13 insertions, 4 deletions
diff --git a/TODO b/TODO
index ad0cba0..a406bfa 100644
--- 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)
diff --git a/files.c b/files.c
index 245b29b..17743a5 100644
--- 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);
}
diff --git a/gramscii.1 b/gramscii.1
index 575a2fc..96dfb47 100644
--- 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
diff --git a/gramscii.h b/gramscii.h
index 7c715a6..0792a38 100644
--- 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 **/
diff --git a/screen.c b/screen.c
index e347ea3..c27ab8b 100644
--- 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;