1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

HexEditor: Scroll back to the top when opening another file

When a file is opened and scrolled to some position and the user opens
another file, the current scroll position stays the same. That's
disorienting. Therefore, when opening another file, scroll back to the
top.
This commit is contained in:
Arne Elster 2021-11-10 02:09:35 +01:00 committed by Brian Gianforcaro
parent fd66dda1d7
commit af754211fa

View file

@ -68,6 +68,9 @@ bool HexEditor::open_new_file(size_t size)
set_content_length(m_document->size());
m_position = 0;
m_cursor_at_low_nibble = false;
m_selection_start = 0;
m_selection_end = 0;
scroll_position_into_view(m_position);
update();
update_status();
@ -80,6 +83,9 @@ void HexEditor::open_file(NonnullRefPtr<Core::File> file)
set_content_length(m_document->size());
m_position = 0;
m_cursor_at_low_nibble = false;
m_selection_start = 0;
m_selection_end = 0;
scroll_position_into_view(m_position);
update();
update_status();
}