fix bug in toggle_trapezium - gramscii - A simple editor for ASCII box-and-arrow charts
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit 646c1c1cc7ecc0cef7f619ae01457659817e5d05
(DIR) parent 47a17a404c2faabc3db70df3a7a64a462a1a9d21
(HTM) Author: KatolaZ <katolaz@freaknet.org>
Date: Sat, 28 Sep 2019 22:31:28 +0100
fix bug in toggle_trapezium
Diffstat:
M draw.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
---
(DIR) diff --git a/draw.c b/draw.c
@@ -251,15 +251,17 @@ void draw_trapezium(int x1, int y1, char st, char fix){
for(i=xmin+1; i<=xmax; i++){
f(i, ylong, line_h);
}
- for(i=xmin+xoff; i<=xmax-xoff; i++){
- f(i, yshort, line_h);
+ if (st & 0x02){ /* Centred trapezium */
+ for(i=xmin+xoff; i<=xmax-xoff; i++){
+ f(i, yshort, line_h);
+ }
}
f(xmin+xoff, yshort, corner);
f(xmin, ylong, corner);
f(xmax-xoff, yshort, corner);
f(xmax, ylong, corner);
xoff --;
- if ((st & BOX_TRAP_D) == BOX_TRAP_D)
+ if ((st & BOX_TRAP_DC) == BOX_TRAP_DC)
xoff = 1;
for(i=ymin+1; i<ymax; i++, xoff += xincr){
f(xmin + xoff, i, left_c);
@@ -291,11 +293,13 @@ void update_box(int x1, int y1, char st, char fix){
char toggle_trap_type(char st){
if (st & BOX_TRAP){
- if (st < BOX_TRAP_DR)
- st ++;
+ if (st != BOX_TRAP_DR)
+ st += 1;
else
st = BOX_TRAP_UR;
}
+ if (st == BOX_TRAP_D)
+ st += 1;
return st;
}