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

Sanitize text pasted into hex text boxes #3684

Merged
merged 9 commits into from
Jun 3, 2024

Conversation

kalimag
Copy link
Contributor

@kalimag kalimag commented Jun 17, 2023

  • Add ClipboardEventTextBox control with an OnPaste method and make HexTextBox and WatchValueBox inherit from that

  • Override normal paste behavior to trim 0x/$/whitespace from pasted text

  • Prevent pasting of non-hex text

Resolves #3682

@adelikat
Copy link
Contributor

adelikat commented May 7, 2024

Does this specifically break any functionality on unix? or just fail to add new functionality? If it is the former, I say we merge this

Copy link
Member

@YoshiRulz YoshiRulz left a comment

Choose a reason for hiding this comment

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

adelikat is right, this is better than what we have. Please rebase.

kalimag added 3 commits May 7, 2024 19:33
Trim `0x` and `$` prefixes and whitespace pasted into `HexTextBox` and `WatchValueBox`. Prevent pasting non-hex text.

Add `ClipboardEventTextBox` control with `OnPaste` event
@kalimag kalimag force-pushed the pr/sanitize-hex-paste branch from c494fd8 to 40dce63 Compare May 7, 2024 23:21
@kalimag
Copy link
Contributor Author

kalimag commented May 14, 2024

HexEditor currently uses NumericStringExtensions.OnlyHex for its own custom paste handling. This could be unified with the new NumericStringExtensions.CleanHex, but it's more broad (e.g. "0xwhat_ever".OnlyHex() == "0AEE").

Copy link
Member

@YoshiRulz YoshiRulz left a comment

Choose a reason for hiding this comment

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

LGTM. Will merge tomorrow if there are no objections.

@YoshiRulz YoshiRulz merged commit 1b961f2 into TASEmulators:master Jun 3, 2024
5 checks passed
@kalimag kalimag deleted the pr/sanitize-hex-paste branch August 5, 2024 05:39
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.

[F.Rq.] Allow pasting 0xHHHH-formatted numbers in a HexTextBox (e.g. in WatchEditor)
3 participants