mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-13 09:50:36 +00:00
LibLine: Fix regression with moving around in history misplacing cursor
This commit fixes a regression where the prompt would not be cleared upon substitution of lines from the history
This commit is contained in:
parent
870936085a
commit
1b422315fa
Notes:
sideshowbarker
2024-07-19 07:45:29 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/1b422315fae Pull-request: https://github.com/SerenityOS/serenity/pull/1723
1 changed files with 16 additions and 6 deletions
|
@ -203,17 +203,27 @@ String Editor::get_line(const String& prompt)
|
|||
case 'A': // up
|
||||
if (m_history_cursor > 0)
|
||||
--m_history_cursor;
|
||||
clear_line();
|
||||
if (m_history_cursor < m_history.size())
|
||||
insert(m_history[m_history_cursor]);
|
||||
if (m_history_cursor < m_history.size()) {
|
||||
auto& line = m_history[m_history_cursor];
|
||||
m_buffer.clear();
|
||||
for (auto& c : line)
|
||||
m_buffer.append(c);
|
||||
m_cursor = m_buffer.size();
|
||||
m_refresh_needed = true;
|
||||
}
|
||||
m_state = InputState::Free;
|
||||
continue;
|
||||
case 'B': // down
|
||||
if (m_history_cursor < m_history.size())
|
||||
++m_history_cursor;
|
||||
clear_line();
|
||||
if (m_history_cursor < m_history.size())
|
||||
insert(m_history[m_history_cursor]);
|
||||
if (m_history_cursor < m_history.size()) {
|
||||
auto& line = m_history[m_history_cursor];
|
||||
m_buffer.clear();
|
||||
for (auto& c : line)
|
||||
m_buffer.append(c);
|
||||
m_cursor = m_buffer.size();
|
||||
m_refresh_needed = true;
|
||||
}
|
||||
m_state = InputState::Free;
|
||||
continue;
|
||||
case 'D': // left
|
||||
|
|
Loading…
Reference in a new issue