fix(float): win_get_bordertext_col returning negative column number (#25752)

Problem:
  `win_get_bordertext_col` returns column < 1 for right or center
  aligned text, if its length is more than window width.

Solution:
  Return max(resulting_column, 1)
This commit is contained in:
nwounkn
2023-10-26 08:44:28 +05:00
committed by GitHub
parent f2fc44550f
commit 9de157bce4
2 changed files with 57 additions and 2 deletions

View File

@@ -735,9 +735,9 @@ int win_get_bordertext_col(int total_col, int text_width, AlignTextPos align)
case kAlignLeft:
return 1;
case kAlignCenter:
return (total_col - text_width) / 2 + 1;
return MAX((total_col - text_width) / 2 + 1, 1);
case kAlignRight:
return total_col - text_width + 1;
return MAX(total_col - text_width + 1, 1);
}
UNREACHABLE;
}