- if ( ! text) return FALSE;
- return psppire_variable_set_width(pv, atoi(text));
+ {
+ int width = atoi (text);
+ if ( ! text) return FALSE;
+ if ( var_is_alpha (pv))
+ var_set_width (pv, width);
+ else
+ {
+ struct fmt_spec fmt ;
+ fmt = *var_get_write_format (pv);
+ if ( width < fmt_min_output_width (fmt.type)
+ ||
+ width > fmt_max_output_width (fmt.type))
+ return FALSE;
+
+ fmt.w = width;
+ fmt.d = MIN (fmt_max_output_decimals (fmt.type, width), fmt.d);
+
+ var_set_both_formats (pv, &fmt);
+ }
+
+ return TRUE;
+ }