pspp-sheet-view: Make Shift+Tab select only one cell when switching rows.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 28 Oct 2012 20:01:47 +0000 (13:01 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 28 Oct 2012 20:01:47 +0000 (13:01 -0700)
Before this commit, Shift+Tab at the start of a row in the data sheet would
select both the new cell and the cell below it.  After this commit, only
the new cell is selected, as one would expect.

Reported by John Darrington.

src/ui/gui/pspp-sheet-view.c

index c06abeb2a6681214ed53b6785d31ed766c47cd2f..9dbec5916b364507f24069e1fb7bf8b34010775e 100644 (file)
@@ -8208,10 +8208,17 @@ pspp_sheet_view_move_cursor_tab (PsppSheetView *tree_view,
   if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     return;
 
-  if (!try_move_cursor_tab (tree_view, TRUE, count)
-      && pspp_sheet_view_move_cursor_up_down (tree_view, count)
-      && !try_move_cursor_tab (tree_view, FALSE, count))
-    gtk_widget_error_bell (GTK_WIDGET (tree_view));
+  if (!try_move_cursor_tab (tree_view, TRUE, count))
+    {
+      /* Shift+Tab goes backward, but Shift isn't supposed to act as Shift does
+         for other movement commands, that is, it shouldn't cause the selection
+         to be extended, so we need to act as though it is off. */
+      tree_view->priv->shift_pressed = FALSE;
+
+      if (pspp_sheet_view_move_cursor_up_down (tree_view, count)
+          && !try_move_cursor_tab (tree_view, FALSE, count))
+        gtk_widget_error_bell (GTK_WIDGET (tree_view));
+    }
 
   pspp_sheet_view_clamp_column_visible (tree_view,
                                         tree_view->priv->focus_column, TRUE);