[WIP] Add Multiline Selections/Operations #3323
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Your checklist for this pull request
Detailed description
The goal is to add the ability to perform multiline selections in the the Disassembly view, so that certain operations in the Disassembly Context Menu (i.e. Set as code, Set as data, Copy lines as text, Add Breakpoints) can be performed on multiple lines/instructions at once.
The main objectives include:
Test plan (required)
Below is a GIF demonstrating the selection of individual lines using Shift + Left Click. The selection color is temporarily set to green for now for visibility during development.
Challenges faced with selections/highlights:
I have not found a way to retain multiline selections when scrolling. The qDebug logs show that the stored cursor positions seem to be invalidated when I scroll, causing all of the cursor offsets in the multiLineSelections list to default to a fallback value. I am thinking that a potential solution could involve storing line numbers instead of cursor positions, and for each line number, retrieve the instruction offset and calculate whether the instruction is visible within the frame upon each viewport update, highlighting the line if so.
Achieving full-line color for individual non-contiguous selections is hindered by QTextEdit's default behavior.
Closing issues
closes #2601