1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

LibLine: Add a setter for the cursor position

This commit is contained in:
AnotherTest 2020-09-16 05:05:03 +04:30 committed by Andreas Kling
parent dd682168a9
commit 2d7aaab897

View file

@ -204,6 +204,12 @@ public:
} }
size_t cursor() const { return m_cursor; } size_t cursor() const { return m_cursor; }
void set_cursor(size_t cursor)
{
if (cursor > m_buffer.size())
cursor = m_buffer.size();
m_cursor = cursor;
}
const Vector<u32, 1024>& buffer() const { return m_buffer; } const Vector<u32, 1024>& buffer() const { return m_buffer; }
u32 buffer_at(size_t pos) const { return m_buffer.at(pos); } u32 buffer_at(size_t pos) const { return m_buffer.at(pos); }
String line() const { return line(m_buffer.size()); } String line() const { return line(m_buffer.size()); }