@@ -322,7 +322,7 @@ static void draw_line(int x, int ph, int l1, int l2, cchar_t *c1, cchar_t *c2,
322322
323323 // Handle drawing based on whether values are positive or negative
324324 if (zero_pos > 0 ) { // We have negative values
325- int y1_start , y1_end , y2_start , y2_end ;
325+ int y1_start , y1_end ;
326326
327327 // For value 1
328328 if (v1 >= 0 ) {
@@ -335,8 +335,17 @@ static void draw_line(int x, int ph, int l1, int l2, cchar_t *c1, cchar_t *c2,
335335 y1_end = ph + 1 - l1 ;
336336 }
337337
338+ // Draw the lines
339+ if (y1_start < y1_end ) {
340+ mvvline_set (y1_start , x , c1 , y1_end - y1_start );
341+ } else if (y1_start > y1_end && l1 > 0 ) {
342+ mvvline_set (y1_end , x , c1 , y1_start - y1_end );
343+ }
344+
338345 // For value 2
339346 if (has_v2 ) {
347+ int y2_start , y2_end ;
348+
340349 if (v2 > 0 ) {
341350 y2_start = ph + 1 - l2 ;
342351 y2_end = ph + 1 - zero_pos ;
@@ -347,15 +356,8 @@ static void draw_line(int x, int ph, int l1, int l2, cchar_t *c1, cchar_t *c2,
347356 y2_start = ph + 1 - zero_pos ;
348357 y2_end = ph + 1 - zero_pos ;
349358 }
350- }
351359
352- // Draw the lines
353- if (y1_start < y1_end ) {
354- mvvline_set (y1_start , x , c1 , y1_end - y1_start );
355- } else if (y1_start > y1_end && l1 > 0 ) {
356- mvvline_set (y1_end , x , c1 , y1_start - y1_end );
357- }
358- if (has_v2 ) {
360+ // Draw the lines
359361 if (y2_start < y2_end ) {
360362 mvvline_set (y2_start , x , & c2r , y2_end - y2_start );
361363 } else if (y2_start > y2_end ) {
0 commit comments