Skip to content

Fix: Reverse highlights unwind incorrectly #2022

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
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kendallgoto
Copy link

Currently, it seems that a recipe calculates its reversed highlights 'forwards' through each operation which creates highlights that don't make sense. While a single recipe's reverseHighlight might work, chaining two operations creates nonsensical reverse highlights. Instead, flip the highlight operation list backwards to 'unwind' the selections when calculating reversed highlights.

Current behavior - in the reverse, ToHexdump applies reverse highlights to map the hexdump's bytes to the input bytes, and FromHex maps from raw input bytes selection to 2 characters/byte selections. When chained, reverse highlighting ends up with a wrong offset while forward highlighting works fine.
image

Resolved behavior - by flipping the highlights array for the reverse direction, we effectively unwind the highlighting when sequencing multiple operations together
image

@kendallgoto kendallgoto force-pushed the kgoto/fix-highlight-reverse branch from 0f2a7a5 to 1f26776 Compare April 10, 2025 03:30
@kendallgoto kendallgoto force-pushed the kgoto/fix-highlight-reverse branch from 1f26776 to 5dbfbb1 Compare April 10, 2025 03:31
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.

1 participant