Rectangle over first character (open with)

Help on how to use HxD.
Post Reply
adejr
Posts: 4
Joined: 27 Nov 2018 08:47

Rectangle over first character (open with)

Post by adejr » 27 Nov 2018 08:53

Using Windows 7 to open a file in HxD using the "open with" (or read-only) shell context menu entry I get the following:

Image

A rectangle is drawn over the first character in the file. I haven't been able to figure out whether this is an option or how to disable it.

If the same file is opened via the shell using drag&drop to an open HxD window or via the file browser dialogs in HxD the rectangles do not appear.

What are these rectangles?

Maël
Site Admin
Posts: 1097
Joined: 12 Mar 2005 14:15

Re: Rectangle over first character (open with)

Post by Maël » 27 Nov 2018 17:28

Since the data is displayed twice, once as text interpretation(2nd column), once as hexadecimal numbers (1st column), there are two carets.
A caret, also called insertion mark, is the vertical line showing you where characters will be inserted in the file.
The rectangle is the ghost caret, which highlights the data in the "inactive" column corresponding to the data in the active one.

If you press the tab key you will see that the ghost and normal caret will be exchanged.

P.S.: No worries about the duplicate posts. I had the same issue, it was due to an updated PHP version.

Maël
Site Admin
Posts: 1097
Joined: 12 Mar 2005 14:15

Re: Rectangle over first character (open with)

Post by Maël » 27 Nov 2018 17:38

I now see that both sides have a rectangle.

This first looked like a drawing bug, but it is due to the datainspector overlaying another rectangle (of a different color) around the bytes that are interpreted in the data inspector. The active row in the data inspector is what determines the length of that rectangle. Change the active row in the data inspector to see how it changes.

The rectangle appears if the datainspector has the focus. Seems opening through the windows explorer context menu focuses the data inspector, instead of the hex editor. It's a minor bug, but you can simply click the datainspector, then the hex editor, and it should be fine again.

P.S.:Please attach the image, instead of linking to imgur.

adejr
Posts: 4
Joined: 27 Nov 2018 08:47

Re: Rectangle over first character (open with)

Post by adejr » 27 Nov 2018 17:45

Here is an additional screenshot:
darksithlordcaret.png
darksithlordcaret.png (33.99 KiB) Viewed 2365 times
Yes the caret functionality works fine. This is a redundant fixed black rectangle that only appears when HxD is launched with a file path parameter. If a file is opened using any other method it never appears, although the caret functionality always works correctly.

This appears to be some sort of drawing bug or initialization issue. I haven't been able to test whether this only occurs on Windows 7 or not but it is possible the current code sets up the caret rectangle (GDI functions?) in a way which fails under specific versions of the OS. The only thing I can think is perhaps there is a missing DeleteObject() or mismatched BeginPaint() EndPaint() calls?

Maël
Site Admin
Posts: 1097
Joined: 12 Mar 2005 14:15

Re: Rectangle over first character (open with)

Post by Maël » 27 Nov 2018 17:46

I just noticed that after I posted, then edited my post.

Here is the relevant part:
The rectangle appears if the datainspector has the focus. Seems opening through the windows explorer context menu focuses the data inspector, instead of the hex editor. It's a minor bug, but you can simply click the datainspector, then the hex editor, and it should be fine again.
So it's a kind of focusing issue.

adejr
Posts: 4
Joined: 27 Nov 2018 08:47

Re: Rectangle over first character (open with)

Post by adejr » 27 Nov 2018 17:48

The cursor remains fixed at the first [0] byte of the file. If the file is scrolled (display offset/index is incremented) beyond the first row the extra rectangle does not appear.

Maël
Site Admin
Posts: 1097
Joined: 12 Mar 2005 14:15

Re: Rectangle over first character (open with)

Post by Maël » 27 Nov 2018 17:49

For me this works: Open as readonly (Explorer), then click on a row in the datainspector, then the hexeditor.

adejr
Posts: 4
Joined: 27 Nov 2018 08:47

Re: Rectangle over first character (open with)

Post by adejr » 27 Nov 2018 17:50

Ah right, yes if I activate the data inspector regardless of how, the rectangle immediately disappears. Is it possible this is an initialization bug?

The code which opens a file from the parameter string must not behave the same way the dialogs or drag&drop do. They seem to initialize the window (inspector object?) parameters correctly.

Maël
Site Admin
Posts: 1097
Joined: 12 Mar 2005 14:15

Re: Rectangle over first character (open with)

Post by Maël » 27 Nov 2018 17:53

It's a focusing issue, what it is idk yet. But the creation order can be different sometimes, Windows is not that deterministic (for example due to PostMessage), and the VCL/Delphi neither. I'll have to see what is causing that.

Post Reply