Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add History to Memory Viewer #1086

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Vancleeff
Copy link
Contributor

Enhanced user experience by providing an history on the memory viewer with the last 50 explored addresses (can move backward or forward)

Enhanced user experience by providing an history on the memory viewer with the last 50 explored addresses (can move backward or forward)
src/ui/viewmodels/MemoryViewerViewModel.hh Outdated Show resolved Hide resolved
src/ui/win32/bindings/MemoryViewerControlBinding.cpp Outdated Show resolved Hide resolved
src/ui/viewmodels/MemoryViewerViewModel.hh Outdated Show resolved Hide resolved
src/ui/viewmodels/MemoryViewerViewModel.hh Outdated Show resolved Hide resolved
src/ui/viewmodels/MemoryViewerViewModel.cpp Outdated Show resolved Hide resolved
src/ui/viewmodels/MemoryViewerViewModel.cpp Outdated Show resolved Hide resolved
src/ui/viewmodels/MemoryViewerViewModel.hh Outdated Show resolved Hide resolved
@@ -287,6 +287,7 @@ void MemoryInspectorViewModel::OnCurrentAddressChanged(ra::ByteAddress nNewAddre
SetValue(CurrentAddressValueProperty, nValue);

m_pViewer.SetAddress(nNewAddress);
m_pViewer.SaveToMemViewHistory();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally going to suggest you just capture the new address in SetAddress, but putting it here addresses another concern I had about the address being captured when navigating via the keyboard. Recommend having unit tests that ensure the history is not modified by keyboard navigation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the AddToHistory directly inside SetAddress() as suggested.
Concerning capturing the keyboard navigation, I was thinking about that at some point and I found it way more convenient to capture it, it's too confusing if we don't track these movements :

Let's say we are on 0x0 then we move to 0x123 after which we start to use the keyboard to find something interresting somewhere near 0x123, after some digging we want to come back to 0x123 so we MoveBackward() but we reach 0x0.
If we want to get back to 0X123 we need to MoveForward() now, which is confusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't want to capture keyboard movements. If you jump to address $1234, then press right and down to get to $1245, then type "ABCDEF", you'll be at $1248 and your history will be: [1234->1235->1245->1246->1247->1248]. If I went back in this scenario, I'd expect to jump back to $1234 (the last thing I jumped to), not to the last character I typed.

Testing in Visual Studio, it's a little more complicated. It doesn't remember where you jump to, it remembers where you jump from. If you click on row 6, character 8, then row 12, character 10, and press down and type "banana", when you hit back it goes to row 6, character 8. Then forward takes you to the position right after "banana".

 - Update naming
 - Move the history list to vector
 - Add ClearHistory function
 - Refactor of the AddToHistory logic
 - Add unit tests
@Vancleeff
Copy link
Contributor Author

Committed ! Thanks @Jamiras !

@Jamiras
Copy link
Member

Jamiras commented Jul 27, 2024

This has conflicts from the +/- PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants