mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +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:
parent
fd66dda1d7
commit
af754211fa
Notes:
sideshowbarker
2024-07-17 22:17:50 +09:00
Author: https://github.com/standardexe
Commit: af754211fa
Pull-request: https://github.com/SerenityOS/serenity/pull/10865
Reviewed-by: https://github.com/kleinesfilmroellchen
1 changed files with 6 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue