Remove useless checks, buffer has always at list one line
This commit is contained in:
parent
217dd6a1de
commit
7bd3f4306d
|
@ -142,9 +142,6 @@ BufferIterator Buffer::iterator_at(ByteCoord coord) const
|
||||||
|
|
||||||
ByteCoord Buffer::clamp(ByteCoord coord) const
|
ByteCoord Buffer::clamp(ByteCoord coord) const
|
||||||
{
|
{
|
||||||
if (m_lines.empty())
|
|
||||||
return ByteCoord{};
|
|
||||||
|
|
||||||
coord.line = Kakoune::clamp(coord.line, 0_line, line_count() - 1);
|
coord.line = Kakoune::clamp(coord.line, 0_line, line_count() - 1);
|
||||||
ByteCount max_col = std::max(0_byte, m_lines[coord.line].length() - 1);
|
ByteCount max_col = std::max(0_byte, m_lines[coord.line].length() - 1);
|
||||||
coord.column = Kakoune::clamp(coord.column, 0_byte, max_col);
|
coord.column = Kakoune::clamp(coord.column, 0_byte, max_col);
|
||||||
|
|
|
@ -102,8 +102,6 @@ inline ByteCoord Buffer::back_coord() const
|
||||||
|
|
||||||
inline ByteCoord Buffer::end_coord() const
|
inline ByteCoord Buffer::end_coord() const
|
||||||
{
|
{
|
||||||
if (m_lines.empty())
|
|
||||||
return { 0_line, 0 };
|
|
||||||
return { line_count() - 1, m_lines.back().length() };
|
return { line_count() - 1, m_lines.back().length() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user