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 [,].
This commit is contained in:
Jean-Marc Lasgouttes 2024-12-02 15:14:34 +01:00
parent 629a692ce2
commit 8e29ad433d
2 changed files with 3 additions and 3 deletions

View File

@ -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();

View File

@ -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