From: Richard Kimberly Heck Date: Mon, 9 Nov 2020 21:36:20 +0000 (-0500) Subject: More comments and minor cleanup X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e53ef4d3667007e07caecee04dcb45715f45b200;p=features.git More comments and minor cleanup --- diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 5379d9fd91..bcba8d2503 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -213,18 +213,21 @@ public: /// which maps the macro definition position to the scope and the MacroData. NamePositionScopeMacroMap macros; - /// positions of child buffers in the buffer + /// Each child Buffer is listed in this map, together with where + /// it is included in this Buffer. + typedef map BufferPositionMap; + BufferPositionMap children_positions; + /// We also have a map from the positions where Buffers are included + /// to those Buffers and their scope (whose point RKH does not yet + /// understand). + // FIXME Surely one of these is enough? struct ScopeBuffer { - ScopeBuffer() : buffer(nullptr) {} + ScopeBuffer() = default; ScopeBuffer(DocIterator const & s, Buffer const * b) : scope(s), buffer(b) {} DocIterator scope; Buffer const * buffer; }; - /// 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; @@ -5461,9 +5464,9 @@ bool Buffer::saveAs(FileName const & fn) void Buffer::checkChildBuffers() { - for (auto const & bit : d->children_positions) { - DocIterator dit = bit.second; - Buffer * cbuf = const_cast(bit.first); + for (auto const & kid : d->children_positions) { + DocIterator const & dit = kid.second; + Buffer * cbuf = const_cast(kid.first); if (!cbuf || !theBufferList().isLoaded(cbuf)) continue; Inset * inset = dit.nextInset(); @@ -5475,7 +5478,9 @@ void Buffer::checkChildBuffers() onlyPath(absFileName())).absFileName(); if (oldloc == newloc) continue; - // the location of the child file is incorrect. + // the location of the child file is incorrect. e.g., it + // had a relative path which does not now point to the correct + // file (after saveAs, usually). cbuf->setParent(nullptr); inset_inc->setChildBuffer(nullptr); }