summaryrefslogtreecommitdiff
path: root/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/draw.c b/draw.c
index 1c383fa..8c30d56 100644
--- a/draw.c
+++ b/draw.c
@@ -148,7 +148,7 @@ void get_box(FILE *fc){
while((c=fgetc(fc))!=EOF && c != 27 && c!= 'b' && c != '\n'){
if (change_style(c))
goto update_box;
- if (!move_around(c, fc))
+ if (!move_around(c, fc, 1))
continue;
check_bound(&x, &y);
redraw();
@@ -166,7 +166,7 @@ update_box:
mode = MOVE;
}
-void draw_arrow(int xl, int yl, char *a, int a_len, int fix){
+void draw_arrow(int xl, int yl, short *a, int a_len, int fix){
int i, j, cur_dir;
char line;
@@ -218,12 +218,12 @@ void get_arrow(FILE *fc){
char c;
int orig_x=x, orig_y=y, arrow_len;
- static char *arrow = NULL;
+ static short *arrow = NULL;
static int arrow_sz;
if (!arrow){
arrow_sz = 100;
- arrow = malloc(arrow_sz * sizeof(char));
+ arrow = malloc(arrow_sz * sizeof(short));
}
arrow_len = 0;
dir = DIR_N;
@@ -234,17 +234,19 @@ void get_arrow(FILE *fc){
while((c=fgetc(fc))!=EOF && c != 27 && c!= 'a' && c != '\n'){
if (change_style(c))
goto update_arrow;
- if (!move_around(c, fc))
+ if (!move_around(c, fc, 0))
continue;
check_bound(&x, &y);
/* FIXME: if we are out of bound, do nothing? */
if (arrow_len == arrow_sz){
arrow_sz *=2;
- arrow = realloc(arrow, arrow_sz * sizeof(char));
+ arrow = realloc(arrow, arrow_sz * sizeof(short));
}
- arrow[arrow_len++] = dir;
- arrow[arrow_len++] = step;
- redraw();
+ if (dir != DIR_N){
+ arrow[arrow_len++] = dir;
+ arrow[arrow_len++] = step;
+ }
+ redraw();
step = 1;
update_arrow:
draw_arrow(orig_x, orig_y, arrow, arrow_len, NOFIX);
@@ -289,7 +291,7 @@ void erase(FILE *fc){
status_bar();
show_cursor();
while((c=fgetc(fc))!=EOF && c!=27 && c!= 'x' && c != '\n'){
- if (!move_around(c, fc)) continue;
+ if (!move_around(c, fc, 0)) continue;
check_bound(&x, &y);
if (first ||
(y != orig_y && ! opened) ||
@@ -329,7 +331,7 @@ void visual_box(FILE *fc){
set_video(VIDEO_REV);
draw_box(x,y,NOFIX);
while((c=fgetc(fc))!=EOF && c != 27 && c!= 'v' && c != '\n'){
- if (!move_around(c, fc)) switch(c){
+ if (!move_around(c, fc, 1)) switch(c){
case 'y': /* yank (copy) */
yank_region(MIN(orig_x,x), MIN(orig_y,y), MAX(orig_x, x), MAX(orig_y, y));
goto vis_exit;