serenity
serenity copied to clipboard
HexEditor: Don't allow to go outside document's size with PageDown key
Currently, if you go to either edit mode (text or hex), and try to go to the end of the document with PageDown button on keyboard, you are allowed to go outside max allowed size. For example, if document is of size 210, you're allowed to go to index 210, which is 211th element (counting from 0). If you try inserting anything on that index, app simply crashes.
This patch fixes it by including 0th index in size, in the cursor_location_change variable in PageDown event.
Also a couple of smaller patches:
- added support for moving to the beginning and end of the document with Home/End key.
- now if user types a byte,
Selection StartandSelection Endlabels are being updated - made a similar change (as to PageDown key) to not allow going outside document's size, but while user selects bytes including the last byte in the document
Hello!
One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.
I've just noticed this has conflicts, please rebase on master and fix them up.
Also, once you've dealt with some feedback, click on the "Resolve conversation" button. It makes it clear to reviewers that it's ready for another review. :^)
This PR was put on stand-by because, after discussing it on Discord, we decided to simplify the code by removing the blinking cursor first and then fixing remaining issues. Now that #22309 has been merged, this work can be resumed :)
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!