skin_display.c cleanup - No functional changes

Change-Id: Ib8ce47d9cf33ba6b02d799862f322e481a712dfb
This commit is contained in:
William Wilgus 2022-10-16 03:44:43 -04:00 committed by William Wilgus
parent 5e7c34f5b3
commit b16bae6fe6

View file

@ -499,8 +499,9 @@ void write_line(struct screen *display, struct align_pos *format_align,
/* CASE 1: left and centered string overlap */ /* CASE 1: left and centered string overlap */
/* there is a left string, need to merge left and center */ /* there is a left string, need to merge left and center */
if ((left_width != 0 && center_width != 0) && if (center_width != 0)
(left_width + space_width > center_xpos)) { {
if (left_width != 0 && left_width + space_width > center_xpos) {
/* replace the former separator '\0' of left and /* replace the former separator '\0' of left and
center string with a space */ center string with a space */
*(--format_align->center) = ' '; *(--format_align->center) = ' ';
@ -510,8 +511,7 @@ void write_line(struct screen *display, struct align_pos *format_align,
center_width = 0; center_width = 0;
} }
/* there is no left string, move center to left */ /* there is no left string, move center to left */
if ((left_width == 0 && center_width != 0) && else if (left_width == 0 && center_xpos < 0) {
(left_width > center_xpos)) {
/* move the center string to the left string */ /* move the center string to the left string */
format_align->left = format_align->center; format_align->left = format_align->center;
/* calculate the new width and position of the string */ /* calculate the new width and position of the string */
@ -519,11 +519,14 @@ void write_line(struct screen *display, struct align_pos *format_align,
/* there is no centered string anymore */ /* there is no centered string anymore */
center_width = 0; center_width = 0;
} }
} /*(center_width != 0)*/
/* CASE 2: centered and right string overlap */ /* CASE 2: centered and right string overlap */
/* there is a right string, need to merge center and right */ /* there is a right string, need to merge center and right */
if ((center_width != 0 && right_width != 0) && if (center_width != 0)
(center_xpos + center_width + space_width > right_xpos)) { {
int center_left_x = center_xpos + center_width;
if (right_width != 0 && center_left_x + space_width > right_xpos) {
/* replace the former separator '\0' of center and /* replace the former separator '\0' of center and
right string with a space */ right string with a space */
*(--format_align->right) = ' '; *(--format_align->right) = ' ';
@ -536,8 +539,7 @@ void write_line(struct screen *display, struct align_pos *format_align,
center_width = 0; center_width = 0;
} }
/* there is no right string, move center to right */ /* there is no right string, move center to right */
if ((center_width != 0 && right_width == 0) && else if (right_width == 0 && center_left_x > right_xpos) {
(center_xpos + center_width > right_xpos)) {
/* move the center string to the right string */ /* move the center string to the right string */
format_align->right = format_align->center; format_align->right = format_align->center;
/* calculate the new width and position of the string */ /* calculate the new width and position of the string */
@ -546,13 +548,15 @@ void write_line(struct screen *display, struct align_pos *format_align,
/* there is no centered string anymore */ /* there is no centered string anymore */
center_width = 0; center_width = 0;
} }
} /*(center_width != 0)*/
/* CASE 3: left and right overlap /* CASE 3: left and right overlap
There is no center string anymore, either there never There is no center string anymore, either there never
was one or it has been merged in case 1 or 2 */ was one or it has been merged in case 1 or 2 */
/* there is a left string, need to merge left and right */ /* there is a left string, need to merge left and right */
if ((left_width != 0 && center_width == 0 && right_width != 0) && if (center_width == 0 && right_width != 0)
(left_width + space_width > right_xpos)) { {
if (left_width != 0 && left_width + space_width > right_xpos) {
/* replace the former separator '\0' of left and /* replace the former separator '\0' of left and
right string with a space */ right string with a space */
*(--format_align->right) = ' '; *(--format_align->right) = ' ';
@ -562,8 +566,7 @@ void write_line(struct screen *display, struct align_pos *format_align,
right_width = 0; right_width = 0;
} }
/* there is no left string, move right to left */ /* there is no left string, move right to left */
if ((left_width == 0 && center_width == 0 && right_width != 0) && else if (left_width == 0 && right_xpos < 0) {
(left_width > right_xpos)) {
/* move the right string to the left string */ /* move the right string to the left string */
format_align->left = format_align->right; format_align->left = format_align->right;
/* calculate the new width and position of the string */ /* calculate the new width and position of the string */
@ -571,6 +574,7 @@ void write_line(struct screen *display, struct align_pos *format_align,
/* there is no right string anymore */ /* there is no right string anymore */
right_width = 0; right_width = 0;
} }
} /* (center_width == 0 && right_width != 0)*/
if (scroll && ((left_width > scroll_width) || if (scroll && ((left_width > scroll_width) ||
(center_width > scroll_width) || (center_width > scroll_width) ||