[gnumeric] GUI: Fix rich text entry problem.



commit 238656c38e6df01ca151995caab639a02aa0b3f0
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 11 14:22:43 2014 -0400

    GUI: Fix rich text entry problem.

 ChangeLog          |   11 +++++++++++
 NEWS               |    1 +
 src/sheet.c        |   13 +++++++++----
 src/wbc-gtk-edit.c |    2 +-
 4 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7d7712b..7e7fc69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-03-11  Morten Welinder  <terra gnome org>
+
+       * src/sheet.c (cb_set_markup): Don't mess directly with
+       cell->value.  We need to trigger a re-render.  Fixes #726086.
+
+       * src/wbc-gtk-edit.c (wbcg_edit_finish): Also supply the markup
+       for the pre-validation assignment.
+
+       * src/sheet.c (sheet_cell_set_text): Put markup on the value
+       before assigning it to the cell.
+
 2014-03-10  Morten Welinder  <terra gnome org>
 
        * gnumeric.xsd: Update valign/halign attributes.  Update print
diff --git a/NEWS b/NEWS
index 6f4cf2c..b199ea4 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Morten:
        * Import/Export super/subscript fonts to xlsx.  [Part of #726035]
        * Import xlsx auto-filters.  [#725460]
        * Update Gnumeric schema.
+       * Fix rich text problem.  [#726086]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.12
diff --git a/src/sheet.c b/src/sheet.c
index 6c5502c..b592c48 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -2879,10 +2879,14 @@ cb_set_markup (GnmCellIter const *iter, PangoAttrList *markup)
 
        if (VALUE_IS_STRING (cell->value)) {
                GOFormat *fmt;
+               GnmValue *val = value_dup (cell->value);
 
                fmt = go_format_new_markup (markup, TRUE);
-               value_set_fmt (cell->value, fmt);
+               value_set_fmt (val, fmt);
                go_format_unref (fmt);
+
+               gnm_cell_cleanout (cell);
+               gnm_cell_assign_value (cell, val);
        }
        return NULL;
 }
@@ -2985,8 +2989,7 @@ sheet_cell_set_text (GnmCell *cell, char const *text, PangoAttrList *markup)
        } else {
                g_return_if_fail (val != NULL);
 
-               gnm_cell_set_value (cell, val);
-               if (markup != NULL && VALUE_IS_STRING (cell->value)) {
+               if (markup != NULL && VALUE_IS_STRING (val)) {
                        gboolean quoted = (text[0] == '\'');
                        PangoAttrList *adj_markup;
                        GOFormat *fmt;
@@ -2999,12 +3002,14 @@ sheet_cell_set_text (GnmCell *cell, char const *text, PangoAttrList *markup)
                                adj_markup = markup;
 
                        fmt = go_format_new_markup (adj_markup, TRUE);
-                       value_set_fmt (cell->value, fmt);
+                       value_set_fmt (val, fmt);
                        go_format_unref (fmt);
                        if (quoted)
                                pango_attr_list_unref (adj_markup);
                }
 
+               gnm_cell_set_value (cell, val);
+
                /* Queue recalc before spanning, see above.  */
                cell_queue_recalc (cell);
 
diff --git a/src/wbc-gtk-edit.c b/src/wbc-gtk-edit.c
index 76985c9..78b3ea3 100644
--- a/src/wbc-gtk-edit.c
+++ b/src/wbc-gtk-edit.c
@@ -381,7 +381,7 @@ wbcg_edit_finish (WBCGtk *wbcg, WBCEditResult result,
                        cell = sheet_cell_fetch (sheet,
                                                 sv->edit_pos.col,
                                                 sv->edit_pos.row);
-                       sheet_cell_set_text (cell, txt, NULL);
+                       sheet_cell_set_text (cell, txt, wbcg->edit_line.markup);
                        valid = gnm_validation_eval (wbc, mstyle, sheet, &sv->edit_pos, showed_dialog);
                        break;
                }


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