[Top][All Lists]

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

[PATCH] gui: Unselect data in data editor when the datasheet is replaced

From: Ben Pfaff
Subject: [PATCH] gui: Unselect data in data editor when the datasheet is replaced.
Date: Tue, 3 May 2011 21:30:46 -0700

The active cell in the PsppireSheet remembers its contents even if
the whole sheet gets replaced, so we have to unselect the cell when
this happens to avoid replacing the cell's contents by whatever was
there before.

Bug #30502.
Thanks to Michel Boaventura for reporting the problem and John
Darrington for diagnosing it.
 src/ui/gui/psppire-data-editor.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c
index c5a3cd3..30098a7 100644
--- a/src/ui/gui/psppire-data-editor.c
+++ b/src/ui/gui/psppire-data-editor.c
@@ -225,6 +225,13 @@ new_data_callback (PsppireDataStore *ds, gpointer data)
       psppire_axis_clear (de->vaxis[i]);
       psppire_axis_append_n (de->vaxis[i], n_cases, DEFAULT_ROW_HEIGHT);
+  /* All of the data (potentially) changed, so unselect any selected cell(s) in
+     the data sheets.  If we don't do this, then the sheet remembers the value
+     that was in the selected cell and stores it back, wiping out whatever
+     value there is in the new data.  Bug #30502. */
+  for (i = 0; i < 4; i++)
+    psppire_sheet_unselect_range (PSPPIRE_SHEET (de->data_sheet[i]));
 static void

reply via email to

[Prev in Thread] Current Thread [Next in Thread]