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
commit af754211fa
Notes: sideshowbarker 2024-07-17 22:17:50 +09:00

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();
}