Fix compute_pos behaviour not to overflow by one line
Thanks to eraserhd for debugging this and proposing an initial fix. Fixes #3414 Close #3418
This commit is contained in:
parent
5466f63eeb
commit
0506de8443
|
@ -124,6 +124,7 @@ struct TerminalUI::Window::Line
|
|||
|
||||
void TerminalUI::Window::blit(Window& target)
|
||||
{
|
||||
kak_assert(pos.line + lines.size() <= target.lines.size());
|
||||
auto target_line = target.lines.begin() + (size_t)pos.line;
|
||||
for (auto& line : lines)
|
||||
{
|
||||
|
@ -1030,10 +1031,10 @@ static DisplayCoord compute_pos(DisplayCoord anchor, DisplayCoord size,
|
|||
if (not prefer_above)
|
||||
{
|
||||
pos = anchor + DisplayCoord{1_line};
|
||||
if (pos.line + size.line > rect_end.line)
|
||||
if (pos.line + size.line >= rect_end.line)
|
||||
pos.line = max(rect.pos.line, anchor.line - size.line);
|
||||
}
|
||||
if (pos.column + size.column > rect_end.column)
|
||||
if (pos.column + size.column >= rect_end.column)
|
||||
pos.column = max(rect.pos.column, rect_end.column - size.column);
|
||||
|
||||
if (to_avoid.size != DisplayCoord{})
|
||||
|
|
Loading…
Reference in New Issue
Block a user