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

LibLine: Properly handle multiline suggestions

This commit is contained in:
AnotherTest 2020-04-14 22:18:56 +04:30 committed by Andreas Kling
parent d09bea5beb
commit 32276cba7a
2 changed files with 32 additions and 7 deletions

View file

@ -151,12 +151,12 @@ private:
size_t num_lines() const
{
return (m_cached_buffer_size + m_num_columns + current_prompt_length()) / m_num_columns;
return (m_cached_buffer_size + m_num_columns + current_prompt_length() - 1) / m_num_columns;
}
size_t cursor_line() const
{
return (m_drawn_cursor + m_num_columns + current_prompt_length()) / m_num_columns;
return (m_drawn_cursor + m_num_columns + current_prompt_length() - 1) / m_num_columns;
}
size_t offset_in_line() const
@ -187,6 +187,7 @@ private:
size_t m_old_prompt_length { 0 };
size_t m_cached_buffer_size { 0 };
size_t m_lines_used_for_last_suggestions { 0 };
size_t m_prompt_lines_at_suggestion_initiation { 0 };
bool m_cached_prompt_valid { false };
// exact position before our prompt in the terminal