From: Richard Kimberly Heck Date: Mon, 9 Nov 2020 20:56:01 +0000 (-0500) Subject: Some comments and some minor re-organization X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4a6d50251a59f6f817ecbbbdb0d3295ee6a3bf5b;p=features.git Some comments and some minor re-organization --- diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 7ed1685327..7237737dad 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -214,7 +214,6 @@ public: NamePositionScopeMacroMap macros; /// positions of child buffers in the buffer - typedef map BufferPositionMap; struct ScopeBuffer { ScopeBuffer() : buffer(nullptr) {} ScopeBuffer(DocIterator const & s, Buffer const * b) @@ -222,10 +221,11 @@ public: DocIterator scope; Buffer const * buffer; }; - typedef map PositionScopeBufferMap; /// position of children buffers in this buffer + typedef map BufferPositionMap; BufferPositionMap children_positions; /// map from children inclusion positions to their scope and their buffer + typedef map PositionScopeBufferMap; PositionScopeBufferMap position_to_children; /// Contains the old buffer filePath() while saving-as, or the diff --git a/src/mathed/MacroTable.h b/src/mathed/MacroTable.h index ab3c6b486f..a6996da40e 100644 --- a/src/mathed/MacroTable.h +++ b/src/mathed/MacroTable.h @@ -112,6 +112,10 @@ private: void updateData() const; /// Buffer const * buffer_; + // FIXME This is probably a large part of why updateMacros is + // so expensive. We are, it would seem, recreating these objects + // from scratch each time through. That seems unnecessary, if what + // usually needs updating is just the pos_ member. /// The position of the definition in the buffer. /// There is no guarantee it stays valid if the buffer /// changes. But it (normally) exists only until the @@ -121,13 +125,20 @@ private: /// returns its defaults values and the user sees unfolded /// macros. mutable DocIterator pos_; - /// + /// flag that tells us whether our cached info is valid. used + /// with lazy version. mutable bool queried_ = false; - /// + // At the moment, it seems to me as if most of the other members + // could be replaced by a pointer to the associated macro (and so + // that one eliminated. I.e.: + // InsetMathMacroTemplate const * const ourmacro_; + // docstring definition() { return ourmacro_->definition(); } + // etc. + /// the macro definition mutable docstring definition_; /// mutable size_t numargs_ = 0; - /// + /// what we use (a kind of LyX macro) for display in the work area mutable docstring display_; /// latexkeys const * sym_ = nullptr;