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 645805 - incorrect sheet object moves
incorrect sheet object moves
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Sheet Objects
git master
Other All
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2011-03-27 06:10 UTC by Andreas J. Guelzow
Modified: 2011-03-27 08:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andreas J. Guelzow 2011-03-27 06:10:15 UTC
With a selected sheet object, shift-arrow should move the object by a row or column. It seems that we have an additional move perpendicular to the intended one.

Note that in static void
drag_object (SheetObject *so, double *coords, ObjDragInfo *info)
{
	static struct {
		int x_idx, y_idx;
	} const idx_info[8] = {
		{ 0, 1}, {-1, 1}, { 2, 1}, { 0,-1},
		{ 2,-1}, { 0, 3}, {-1, 3}, { 2, 3}
	};

	g_return_if_fail (info->drag_type <= 8);

	if (info->drag_type == 8) {
		apply_move (so, 0, 1, coords, info, info->snap_to_grid);
		apply_move (so, 2, 3, coords, info, FALSE);
	} else
		apply_move (so,
			    idx_info[info->drag_type].x_idx,
			    idx_info[info->drag_type].y_idx,
			    coords, info, info->snap_to_grid);
	SCG_FOREACH_PANE (info->scg, pane,
		gnm_pane_object_update_bbox (pane, so););
}

we have two "apply_move" in this case which is somewhat surprising.
Comment 1 Andreas J. Guelzow 2011-03-27 06:27:28 UTC
The problem seems to be due to the snap-to-grid. Repeated snapping to grid moves us right or down.
Comment 2 Andreas J. Guelzow 2011-03-27 06:41:52 UTC
We can fix this issue by deleting the "0.5" inside:

 static double
snap_pos_to_grid (ObjDragInfo const *info, gboolean is_col, double w_pos,
		  gboolean to_min)
{
...
	double pos = w_pos + 0.5;

I don't quite know why we had this here in the first place so I am hesitant just to change it and possibly causing a different bug elsewhere.
Comment 3 Jean Bréfort 2011-03-27 06:56:28 UTC
May be:

floor (w_pos . 0.5);
Comment 4 Jean Bréfort 2011-03-27 06:56:46 UTC
floor (w_pos + 0.5);
Comment 5 Andreas J. Guelzow 2011-03-27 08:01:12 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 6 Andreas J. Guelzow 2011-03-27 08:02:25 UTC
Note that I just skipped the 0.5. We should remember tis though in case we are observing some issues.