-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
hex editor -> location in pattern editor #2344
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
Open
shewitt-au
wants to merge
39
commits into
WerWolv:master
Choose a base branch
from
shewitt-au:goto-in-pattern-editor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+37
−1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ImHex into accurate-column
6e6685b
to
0bebe8c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Feature description
Add the ability to go from a coloured selection in the hex editor to the location responsible in the pattern editor.
The corresponding pattern language mods are here.
Demo
demo.mp4
Notes
Going to the line instead of the exact variable location would probably be just as good. Possibly better. Part of the reason I made it this way is because column information was being, in some cases, incorrectly calculated. In part it's like this so I could easily check (at least in some cases) that the column information was correct. I think this feature is useful, but a large part of my motivation was to make it this way (exact location) was as a debugging tool.
I made this PR to correct incorrect column calculations in the lexer. They were caused by tabs. This code was rejected in favour of string search-&-replaces before parsing. I think the lexer should handle tabs but what is is. Even if S&R preprocessing is needed now, in future if tabs are supported a lexer that won’t choke on them is one less issue to address. That said, although this PR origionally contained the lexer mods, I have removed them. The code as is seems to work and every S&R seems to feed the text editor (and possibly the lexer too), which can't handle tabs.
I have reused an existing icon in the menu. I guess this could be confusing, I'm no artist however.
Implementation description
We lex, then preprocess and then parse. Then an AST is built. Stuff happens. Eventually we get patterns. I had to make changes to get the line/column info from the lexer to the patterns. There were some places where the location information was incorrect or not useful. All that said, I think I've got the info from the lexer to the patterns without any collateral damage. But I could be wrong.
No more work in this
I am not going to work on this any further. It's far from perfect.
I can't help but I feel I'm wasting my time trying to contribute to ImHex. From my perspective my PRs are just rejected in favour of solutions which, in my opinion, make the product as a whole more fragile and harder to improve. I take the time to justify my choices but get only destructive criticism. I will complete my in progress stuff. Beyond that I can't say.