]> git.lyx.org Git - features.git/commitdiff
Do not rely on math macros being updated
authorEnrico Forestieri <forenr@lyx.org>
Sun, 25 Sep 2016 18:31:13 +0000 (20:31 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Sun, 25 Sep 2016 18:31:13 +0000 (20:31 +0200)
Trying to spare a few cycles by avoiding computing metrics during
screen updates and export. See also 8f86ee7472cf7c8f, and e36a8903.
Guillaume will tell whether this also avoids crashing his documents ;)

src/BufferView.cpp
src/mathed/MathMacro.cpp

index ad40dd6b2828afd9a101572577380c9929488c4f..cb7ea79050ca0a22d9afeabe25a20e0ff30941ab 100644 (file)
@@ -495,9 +495,7 @@ void BufferView::processUpdateFlags(Update::flags flags)
 
        // updateMetrics() does not update paragraph position
        // This is done at draw() time. So we need a redraw!
-       // We pass true so that metrics are computed for the sake
-       // of having MacroData updated.
-       buffer_.changed(true);
+       buffer_.changed(false);
 
        if (needsFitCursor()) {
                // The cursor is off screen so ensure it is visible.
@@ -2167,9 +2165,7 @@ void BufferView::updateHoveredInset() const
 
                // This event (moving without mouse click) is not passed further.
                // This should be changed if it is further utilized.
-               // We pass true so that metrics are computed for the sake
-               // of having MacroData updated.
-               buffer_.changed(true);
+               buffer_.changed(false);
        }
 }
 
index d1a8b50c7b69233d2bd4ed43521edfd5b0615661..06a55bf7036d391756f80417f045d6e57e52d092 100644 (file)
@@ -939,11 +939,11 @@ bool MathMacro::folded() const
 
 void MathMacro::write(WriteStream & os) const
 {
-       bool user_macro = !MacroTable::globalMacros().get(name());
-       bool textmode_macro = user_macro ? false : d->macro_ && d->macro_->symbol()
-                               && d->macro_->symbol()->extra == "textmode";
-       bool needs_mathmode = user_macro ? bool(d->macro_) : d->macro_ && (!d->macro_->symbol()
-                               || d->macro_->symbol()->extra != "textmode");
+       MacroData const * data = MacroTable::globalMacros().get(name());
+       bool textmode_macro = data && data->symbol()
+                                  && data->symbol()->extra == "textmode";
+       bool needs_mathmode = data && (!data->symbol()
+                                      || data->symbol()->extra != "textmode");
 
        MathEnsurer ensurer(os, needs_mathmode, true, textmode_macro);