ghex r1226 - in trunk: . src



Author: jjongsma
Date: Sat Feb  7 04:10:04 2009
New Revision: 1226
URL: http://svn.gnome.org/viewvc/ghex?rev=1226&view=rev

Log:
Fix errors in reporting number of selected bytes (Bug #564372)

	* src/ghex-window.c:
	(ghex_window_update_status_message): Fix an off-by-one error in reporting
	the number of bytes selected in the status bar.
	* src/gtkhex.c:
	(gtk_hex_set_cursor): emit the 'cursor-moved' signal later to fix broken
	reporting of selection range when selecting text with the keyboard

Modified:
   trunk/ChangeLog
   trunk/src/ghex-window.c
   trunk/src/gtkhex.c

Modified: trunk/src/ghex-window.c
==============================================================================
--- trunk/src/ghex-window.c	(original)
+++ trunk/src/ghex-window.c	Sat Feb  7 04:10:04 2009
@@ -651,7 +651,9 @@
                           offset_fmt, offset_fmt, offset_fmt) < FMT_LEN) {
                 len = strlen(status);
                 if(len < STATUS_LEN) {
-                    g_snprintf(status + len, STATUS_LEN - len, fmt, se - ss, ss, se);
+                    // Variables 'ss' and 'se' denotes the offsets of the first and
+                    // the last bytes that are part of the selection.
+                    g_snprintf(status + len, STATUS_LEN - len, fmt, se - ss + 1, ss, se);
                 }
             }
         }

Modified: trunk/src/gtkhex.c
==============================================================================
--- trunk/src/gtkhex.c	(original)
+++ trunk/src/gtkhex.c	Sat Feb  7 04:10:04 2009
@@ -2144,8 +2144,6 @@
 		if(index == gh->document->file_size)
 			gh->lower_nibble = FALSE;
 		
-		g_signal_emit_by_name(G_OBJECT(gh), "cursor_moved");
-
 		if(gh->selecting) {
 			gtk_hex_set_selection(gh, gh->selection.start, gh->cursor_pos);
 			bytes_changed(gh, MIN(gh->cursor_pos, old_pos), MAX(gh->cursor_pos, old_pos));
@@ -2156,6 +2154,9 @@
 			bytes_changed(gh, start, end);
 			gh->selection.end = gh->selection.start = gh->cursor_pos;
 		}
+
+		g_signal_emit_by_name(G_OBJECT(gh), "cursor_moved");
+
 		bytes_changed(gh, old_pos, old_pos);
 		show_cursor(gh);
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]