summaryrefslogtreecommitdiff
path: root/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/screen.c b/screen.c
index d60abb2..d85ff81 100644
--- a/screen.c
+++ b/screen.c
@@ -58,7 +58,7 @@ char get_mark(char dir){
void status_bar(){
- if (silent)
+ if (script)
return;
printf("\033[%d;1f\033[7m", HEIGHT+1);
printf("%*s", WIDTH-1, "");
@@ -78,7 +78,7 @@ void status_bar(){
char get_key(FILE *fc, char *msg){
- if (silent)
+ if (script)
return 0;
printf("\033[%d;1f\033[7m", HEIGHT+1);
printf("%*s", WIDTH, "");
@@ -92,7 +92,7 @@ char get_key(FILE *fc, char *msg){
void get_string(FILE *fc, char *msg, char *s, int sz){
- if (!silent){
+ if (!script){
printf("\033[%d;1f\033[7m", HEIGHT+1);
printf("%*s", WIDTH, "");
printf("\033[%d;1f\033[7m", HEIGHT+1);
@@ -106,9 +106,10 @@ void get_string(FILE *fc, char *msg, char *s, int sz){
}
fgets(s, sz, fc);
s[strlen(s)-1] = '\0';
- tcsetattr(0, TCSANOW, &t2);
- if (!silent)
+ if (!script){
+ tcsetattr(0, TCSANOW, &t2);
fflush(stdout);
+ }
}
int is_yes(char c){
@@ -119,7 +120,7 @@ int is_yes(char c){
void show_cursor(){
- if (silent)
+ if (script)
return;
printf("\033[%d;%df", y+1, x+1);
fflush(stdout);
@@ -144,7 +145,7 @@ void set_cur(char c){
void draw_xy(int x, int y, char c){
/* FIXME: check if x and y are valid!!!! */
- if (silent)
+ if (script)
return;
printf("\033[%d;%df",y+1,x+1);
putchar(c);
@@ -152,7 +153,7 @@ void draw_xy(int x, int y, char c){
}
void update_current(){
- if (silent)
+ if (script)
return;
printf("\033[%d;%df",y+1,x+1);
putchar(screen.l[y].s[x]);
@@ -226,7 +227,7 @@ void reset_styles(){
void redraw(){
int i;
- if (silent)
+ if (script)
return;
printf("\033[2J\033[1;1H");
for (i=0;i<HEIGHT;i++){
@@ -254,9 +255,9 @@ void go_to(int where){
show_cursor();
}
-void handle_goto(char global){
+void handle_goto(FILE *fc, char global){
char c;
- c=getchar();
+ c=fgetc(fc);
switch(c){
case 'h':
dir = DIR_L;
@@ -348,6 +349,9 @@ int move_around(char c, FILE *fc, char global){
mult += c - '0';
return 0;
}
+#ifdef DEBUG
+ fprintf(stderr, "got char: %c\n", c);
+#endif
switch(c){
case 27: /* control sequence? */
c = get_escape(fc);
@@ -382,11 +386,11 @@ int move_around(char c, FILE *fc, char global){
break;
case 'g':
#ifdef DEBUG
- fprintf(stderr, "before global: step: %d x: %d y: %d\n", step, x, y);
+ fprintf(stderr, "before handle_goto: step: %d x: %d y: %d global: %d\n", step, x, y, global);
#endif
- handle_goto(global);
+ handle_goto(fc, global);
#ifdef DEBUG
- fprintf(stderr, "after global: step: %d x: %d y: %d\n", step, x, y);
+ fprintf(stderr, "after handle_goto: step: %d x: %d y: %d global: %d\n", step, x, y, global);
#endif
break;
default:
@@ -398,7 +402,7 @@ int move_around(char c, FILE *fc, char global){
void set_video(int v){
- if (silent)
+ if (script)
return;
printf("\033[%dm", v);
fflush(stdout);