diff --git a/src/gui/interact/ui-coord-resolver.hpp b/src/gui/interact/ui-coord-resolver.hpp index f7b901498..5abc497bc 100644 --- a/src/gui/interact/ui-coord-resolver.hpp +++ b/src/gui/interact/ui-coord-resolver.hpp @@ -322,7 +322,6 @@ namespace interact { res_.depth = res_.covfefe->size(); this->uic_ = std::move (*res_.covfefe); res_.covfefe.reset(); - ENSURE (isCovered()); } else { @@ -331,6 +330,7 @@ namespace interact { REQUIRE (not res_.covfefe); truncateTo (0); } + ENSURE (isCovered()); return std::move (*this); } @@ -366,7 +366,6 @@ namespace interact { ENSURE (isCovered()); append (pathExtension); res_.depth = query_.determineCoverage (this->uic_); // coverage may grow - ENSURE (isCoveredPartially()); return std::move (*this); } @@ -374,27 +373,28 @@ namespace interact { extend (UICoord const& partialExtensionSpec) { if (not canCover()) - { - uic_ = partialExtensionSpec; - } + uic_ = partialExtensionSpec; else { - ENSURE (res_.isResolved and res_.covfefe); - size_t coverable = res_.covfefe->size(); + REQUIRE (res_.isResolved); + size_t coverable = res_.covfefe? res_.covfefe->size() : res_.depth; auto newContent = partialExtensionSpec.begin(); size_t extensionPos = newContent? partialExtensionSpec.indexOf(*newContent) : 0; if (coverable >= extensionPos) throw error::Invalid (util::_Fmt{"Attempt to extend covered path %s with %s " "would overwrite positions %d to %d (incl)"} - % *res_.covfefe + % (res_.covfefe? *res_.covfefe : UICoord{uic_.rebuild().truncateTo(res_.depth)}) % partialExtensionSpec % extensionPos % coverable); cover(); for ( ; newContent; ++newContent, ++extensionPos ) overwrite (extensionPos, *newContent); + normalise(); } - res_.depth = query_.determineCoverage (this->uic_); // coverage may grow + res_ = Resolution{}; // start over with pristine resolution state + attempt_trivialResolution(); + canCover(); return std::move (*this); } diff --git a/src/gui/interact/ui-coord.hpp b/src/gui/interact/ui-coord.hpp index 0ad6b43c9..5c6675ba2 100644 --- a/src/gui/interact/ui-coord.hpp +++ b/src/gui/interact/ui-coord.hpp @@ -158,6 +158,7 @@ namespace interact { Builder path (Literal pathDefinition) const; Builder append (Literal elmID) const; Builder prepend (Literal elmID) const; + Builder rebuild() const; @@ -711,6 +712,12 @@ namespace interact { return Builder(*this).prepend (elmID); } + inline UICoord::Builder + UICoord::rebuild () const + { + return Builder(*this); + } + }}// namespace gui::interact diff --git a/tests/gui/interact/ui-coord-resolver-test.cpp b/tests/gui/interact/ui-coord-resolver-test.cpp index f27bffef6..cf5480db2 100644 --- a/tests/gui/interact/ui-coord-resolver-test.cpp +++ b/tests/gui/interact/ui-coord-resolver-test.cpp @@ -634,18 +634,24 @@ namespace test { /* === extend fully covered explicit path === */ UICoordResolver r1 {UICoord{"window-2","persp-B","panelY"}, tree}; - r1.extend (UICoord().path("engulfed")); + r1.extend (UICoord().path("gappy").tab(2)); + cout << string(r1)< - - + + - + - - + + + - + + + @@ -9368,10 +9371,10 @@ - - - - + + + + @@ -9387,6 +9390,12 @@ + + + + + +