After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 564372 - ghex reports the wrong number of bytes selected
ghex reports the wrong number of bytes selected
Status: RESOLVED FIXED
Product: ghex
Classification: Applications
Component: general
unspecified
Other All
: Normal minor
: ---
Assigned To: GHex maintainers
GHex maintainers
: 411572 571542 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-12-13 12:23 UTC by Martin Olsson
Modified: 2009-02-12 21:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch that fixes this bug by correctly calculating the number of bytes in the selection (566 bytes, patch)
2008-12-13 12:23 UTC, Martin Olsson
none Details | Review
updated patch (fixes both mouse and keyboard use cases) (1.79 KB, patch)
2009-02-05 14:30 UTC, Martin Olsson
committed Details | Review

Description Martin Olsson 2008-12-13 12:23:03 UTC
Please describe the problem:
When you select three bytes in ghex the status bar says "2 bytes selected". This is easy to spot for small selections but at some point I was trying to find out where the next section header in an ELF began (those are 64 bytes long) and this bug got me really confused.

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Martin Olsson 2008-12-13 12:23:47 UTC
Created attachment 124575 [details] [review]
patch that fixes this bug by correctly calculating the number of bytes in the selection
Comment 2 Jonathon Jongsma 2009-01-27 03:43:31 UTC
This does seem to improve things when selecting with the mouse, but there are still some bugs when selecting values using the keyboard rather than the mouse.  For example, open a file, put the cursor on the first byte, hold down shift, and press right arrow several times.  The reported selection count seems to be too low by 1 byte.  Now, with shift still held down, press left arrow to de-select one more byte.  strangely, the selection count in the status bar actually increases, so now instead of being too low by 1, the count is too high by one.
Comment 3 Martin Olsson 2009-02-05 14:30:38 UTC
Created attachment 128007 [details] [review]
updated patch (fixes both mouse and keyboard use cases)

As it turns out the keyboard and mouse scenarios where broken due to pretty different reasons. After fiddling around with various ways of solving the keyboard selection bytes problem I think the cleanest fix is to emit the cursor_moved signal slightly later.

Here is an updated patch that should fix both mouse and keyboard scenarios completely.
Comment 4 Jonathon Jongsma 2009-02-07 04:12:51 UTC
Thanks a lot for looking into this.  I've committed your change, except the part that changed the status bar text (so that we don't lose existing translations).  r1226
Comment 5 Rodney Dawes 2009-02-09 14:59:21 UTC
*** Bug 411572 has been marked as a duplicate of this bug. ***
Comment 6 Jonathon Jongsma 2009-02-12 21:44:04 UTC
*** Bug 571542 has been marked as a duplicate of this bug. ***