]> git.lyx.org Git - features.git/commitdiff
Comments cleanup/updateMacros4
authorRichard Kimberly Heck <rikiheck@lyx.org>
Sun, 6 Dec 2020 00:48:16 +0000 (19:48 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Sun, 6 Dec 2020 01:13:28 +0000 (20:13 -0500)
src/Buffer.cpp
src/CursorSlice.cpp
src/mathed/InsetMathMacro.cpp

index 8ddbe67caf2d3072ffacbbb529825ee95afef268..4cf57587430591446631e5a56f02e477e0883d7b 100644 (file)
@@ -3749,7 +3749,7 @@ MacroData const * Buffer::getMacro(docstring const & name, bool global) const
 MacroData const * Buffer::getMacro(docstring const & name,
        Buffer const & child, bool global) const
 {
-       // look where the child buffer is included first
+       // find out where the child buffer is first included
        Impl::BufferPositionMap::iterator it = d->children_positions.find(&child);
        if (it == d->children_positions.end()) {
                if (d->file_fully_loaded)
index 872a91110e7996ffa1eb194add86d38e347c6cf2..ff56ce17bf868851b4baab56caabaa4e9392ee0d 100644 (file)
@@ -48,7 +48,9 @@ CursorSlice::CursorSlice(Inset & p)
 
 MathData & CursorSlice::cell() const
 {
-       return inset_->asInsetMath()->cell(idx_);
+       InsetMath * im = inset_->asInsetMath();
+       LBUFERR(im);
+       return im->cell(idx_);
 }
 
 
index ab9af5f5e8631fa017062aa4eef2522e31314ed6..420df09209091ada5b9dc67c02c78d0cb3485917 100644 (file)
@@ -230,10 +230,9 @@ public:
        size_t optionals_;
        /// fold mode to be set in next metrics call?
        bool nextFoldMode_;
-       /// if macro_ == true, then here is a copy of the macro
+       /// here is a copy of the macro, for safety purposes
        /// don't use it for locking
        MacroData macroBackup_;
-       /// if macroNotFound_ == false, then here is a reference to the macro
        /// this might invalidate after metrics was called
        MacroData const * macro_;
        ///
@@ -703,7 +702,7 @@ void InsetMathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc,
        // get default values of macro
        vector<docstring> const & defaults = d->macro_->defaults();
 
-       // create MathMacroArgumentValue objects pointing to the cells of the macro
+       // create InsetArgumentProxy objects pointing to the cells of the macro
        vector<MathData> values(nargs());
        for (size_t i = 0; i < nargs(); ++i) {
                InsetArgumentProxy * proxy;
@@ -721,9 +720,9 @@ void InsetMathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc,
        // InsetMathMacro objects, so this would be a different recursion path
        // than the one protected by UpdateLocker.
        docstring const & display = d->macro_->display();
-       docstring const latexname = from_ascii("\\") + macroName();
        bool const ret = d->macro_->expand(values, d->expanded_);
        d->expanded_.setBuffer(buffer());
+       docstring const latexname = from_ascii("\\") + macroName();
        if (ret && !support::contains(display, latexname)) {
                if (utype == OutputUpdate && !d->expanded_.empty())
                        d->expanded_.updateMacroInstances(cur, mc, utype, nesting);