From af754211fa41e37ad897b5e222f24ace35f9b83e Mon Sep 17 00:00:00 2001 From: Arne Elster Date: Wed, 10 Nov 2021 02:09:35 +0100 Subject: [PATCH] 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. --- Userland/Applications/HexEditor/HexEditor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Applications/HexEditor/HexEditor.cpp b/Userland/Applications/HexEditor/HexEditor.cpp index eb47bc0614..bcfa169c82 100644 --- a/Userland/Applications/HexEditor/HexEditor.cpp +++ b/Userland/Applications/HexEditor/HexEditor.cpp @@ -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 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(); }