mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user