From 8e29ad433d649688879466532990db4f901a5673 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 2 Dec 2024 15:14:34 +0100 Subject: [PATCH] Fixup 91d1ad31: beware of the reurn values of getPosNearX The pair returned by TextMetrics;;getPosNearX is (position, boundary). Here one had to use short variable names p and b because 'pos' and 'boundary' are a members of Cursor, and [b, p] was use dinstead of [p,b]. Here, we added a bool & version of boundary() instead to the usual getter/setter paradigm, because pos() is already like that. It might be that the setter should be removed later. Using these two members, it is now possible to use std::tie instead of auto [,]. --- src/Cursor.cpp | 4 +--- src/DocIterator.h | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 6c94716e66..fa844b2946 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -2286,9 +2286,7 @@ bool Cursor::upDownInText(bool up) } Row const & real_next_row = tm.parMetrics(pit()).rows()[next_row]; - auto [b, p] = tm.getPosNearX(real_next_row, xo); - pos() = p; - boundary(b); + tie(pos(), boundary()) = tm.getPosNearX(real_next_row, xo); // When selection==false, this is done by TextMetrics::editXY setCurrentFont(); diff --git a/src/DocIterator.h b/src/DocIterator.h index 7c6f017b5f..543f10a60b 100644 --- a/src/DocIterator.h +++ b/src/DocIterator.h @@ -129,6 +129,8 @@ public: /// bool boundary() const { return boundary_; } /// + bool & boundary() { return boundary_; } + /// void boundary(bool b) { boundary_ = b; } // the two methods below have been inlined out because of