1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibLine: Move the search editor exactly after the last line

Previously, we'd always put it right after the prompt.
This commit is contained in:
AnotherTest 2021-02-21 04:38:36 +03:30 committed by Andreas Kling
parent 9790ee4649
commit d8a3285d78
Notes: sideshowbarker 2024-07-18 22:04:26 +09:00

View file

@ -244,6 +244,9 @@ void Editor::enter_search()
add_child(*m_search_editor);
m_search_editor->on_display_refresh = [this](Editor& search_editor) {
// Remove the search editor prompt before updating ourselves (this avoids artifacts when we move the search editor around).
search_editor.cleanup();
StringBuilder builder;
builder.append(Utf32View { search_editor.buffer().data(), search_editor.buffer().size() });
if (!search(builder.build(), false, false)) {
@ -252,7 +255,13 @@ void Editor::enter_search()
m_buffer.clear();
m_cursor = 0;
}
refresh_display();
// Move the search prompt below ours and tell it to redraw itself.
auto prompt_end_line = current_prompt_metrics().lines_with_addition(m_cached_buffer_metrics, m_num_columns);
search_editor.set_origin(prompt_end_line + 1, 1);
search_editor.m_refresh_needed = true;
};
// Whenever the search editor gets a ^R, cycle between history entries.