gui: render empty string for numeric system missing value
authorFriedrich Beckmann <friedrich.beckmann@gmx.de>
Wed, 8 Jul 2020 07:44:55 +0000 (09:44 +0200)
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>
Wed, 8 Jul 2020 12:10:04 +0000 (14:10 +0200)
Numeric cells which contain the system missing value are currently rendered
as a number of spaces, a dot and a number of spaces depending on the
current variable width and decimal places settings. When the cell is
edited, then this string is pretty confusing.
With the patch system missing values for numeric variables are rendered
as empty strings. Editing the cell is then straightforward and starts
with an empty cell.

src/ui/gui/psppire-data-store.c

index 012c010fe61ad7b6a1b7b5df417a78e1e48545ec..8ac492884c1c11b88709e809dfc56793443ff828 100644 (file)
@@ -171,6 +171,10 @@ psppire_data_store_string_to_value (GtkTreeModel *model, gint col, gint row,
 static char *
 unlabeled_value (PsppireDataStore *store, const struct variable *variable, const union value *val)
 {
+  if (var_is_numeric (variable) &&
+      var_is_value_missing (variable, val, MV_SYSTEM))
+    return g_strdup ("");
+
   const struct fmt_spec *fmt = var_get_print_format (variable);
   return data_out (val, psppire_dict_encoding (store->dict),  fmt);
 }