ImHex icon indicating copy to clipboard operation
ImHex copied to clipboard

[Bug] Scroll position when moving or selecting bytes down in hex editor using arrow keys

Open heapoverride opened this issue 1 year ago • 3 comments

Operating System

Windows

What's the issue you encountered?

Cursor (selected byte) isn't scrolled to view when the selection moves outside of the hex editor's view going down using right/down arrow keys. When selecting bytes going down (right/down arrow keys again), it looks like it scrolls to the start of the selection which is not correct. Also, it doesn't scroll down enough for the cursor to be in view.

How can the issue be reproduced?

  1. Move the cursor down in the hex editor view until it goes out of view
  2. Make a large enough selection that doesn't fit in the hex editor view

ImHex Version

1.33.1

ImHex Build Type

  • [ ] Nightly or built from sources

Installation type

MSI

Additional context?

heapoverride avatar Mar 02 '24 23:03 heapoverride

When you press the down arrow the cursor travels down the screen until it hits the last line of the window. Going down further scrolls the imhex display up one line at the time. Imhex probably calculates which is the last line based on the size of the window and doesn't take into account that the information panel hides the last couple of lines. Note that same behavior occurs with pgup/pgdown. To fix this issue imhex should make the last visible line the bottom of the display instead of relying on the window size.

I was able to reproduce the selection error but not using your instructions. Selecting using mouse works fine, but if you use the arrow keys + shift key to select then when the selection is larger than the display the scroll jumps up so that the start of the selection is also hidden by the info panel. This occurs for (shift +) up down left right pgup and pgdwn keys.

To get around the problem until it gets fixed note that you can always scroll using the mouse wheel to see any part of the selection without having to stop selecting as long as the shift key remains pressed (or select using mouse). Also click on the start of the selection and shift click on the end gives you complete selection control without any issues.

paxcut avatar Mar 03 '24 01:03 paxcut

Perhaps I should've specified that cursor here means the selected byte in the hex editor view. I wasn't talking about mouse cursor at any point. I'm also not a native speaker so thanks for adding more context to this.

heapoverride avatar Mar 03 '24 01:03 heapoverride

I wanted to make sure it was stated that the issue only occurs when using the keyboard to move cursor or select bytes but using the mouse works fine.

paxcut avatar Mar 03 '24 01:03 paxcut