variable: Report only changes in width that actually change it.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 25 May 2014 22:37:15 +0000 (15:37 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 25 May 2014 22:37:15 +0000 (15:37 -0700)
For me, this fixes the problem reported by Fran A. <pacodea2001@yahoo.es>
when I resize the width of the second variable in a data file provided
by John Darrington.

src/data/variable.c

index 8758af35b429b6cc026aead9db207aeb283fc339..971154368cb7ae5ede7b21d4f88374e6f1e4b752 100644 (file)
@@ -967,12 +967,14 @@ var_set_display_width_quiet (struct variable *v, int new_width)
 void
 var_set_display_width (struct variable *v, int new_width)
 {
-  struct variable *ov = var_clone (v);
-  var_set_display_width_quiet (v, new_width);
-  dict_var_changed (v, VAR_TRAIT_DISPLAY_WIDTH, ov);
+  if (v->display_width != new_width)
+    {
+      struct variable *ov = var_clone (v);
+      var_set_display_width_quiet (v, new_width);
+      dict_var_changed (v, VAR_TRAIT_DISPLAY_WIDTH, ov);
+    }
 }
 
-
 /* Returns the default display width for a variable of the given
    WIDTH, as set by var_create.  The return value can be used to
    reset a variable's display width to the default. */