negative coordinates are invalid
This commit is contained in:
parent
8ab1f58594
commit
7bc73b7ef9
|
@ -52,6 +52,9 @@ inline ByteCount Buffer::offset(ByteCoord c) const
|
|||
|
||||
inline bool Buffer::is_valid(ByteCoord c) const
|
||||
{
|
||||
if (c.line < 0 or c.column < 0)
|
||||
return false;
|
||||
|
||||
return (c.line < line_count() and c.column < m_lines[c.line].length()) or
|
||||
(c.line == line_count() - 1 and c.column == m_lines.back().length()) or
|
||||
(c.line == line_count() and c.column == 0);
|
||||
|
|
Loading…
Reference in New Issue
Block a user