mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Reset right_boundary row property when row is shortened
Fixes bug #10003.
This commit is contained in:
parent
869d34ddeb
commit
5f9053d6d3
12
src/Row.cpp
12
src/Row.cpp
@ -413,10 +413,10 @@ void Row::pop_back()
|
||||
}
|
||||
|
||||
|
||||
void Row::shortenIfNeeded(pos_type const keep, int const w)
|
||||
bool Row::shortenIfNeeded(pos_type const keep, int const w)
|
||||
{
|
||||
if (empty() || width() <= w)
|
||||
return;
|
||||
return false;
|
||||
|
||||
Elements::iterator const beg = elements_.begin();
|
||||
Elements::iterator const end = elements_.end();
|
||||
@ -433,7 +433,7 @@ void Row::shortenIfNeeded(pos_type const keep, int const w)
|
||||
if (cit == end) {
|
||||
// This should not happen since the row is too long.
|
||||
LYXERR0("Something is wrong cannot shorten row: " << *this);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Iterate backwards over breakable elements and try to break them
|
||||
@ -476,7 +476,7 @@ void Row::shortenIfNeeded(pos_type const keep, int const w)
|
||||
dim_.wid = wid_brk + brk.dim.wid;
|
||||
// If there are other elements, they should be removed.
|
||||
elements_.erase(cit_brk + 1, end);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,7 +493,7 @@ void Row::shortenIfNeeded(pos_type const keep, int const w)
|
||||
end_ = cit->pos;
|
||||
dim_.wid = wid;
|
||||
elements_.erase(cit, end);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* If we are here, it means that we have not found a separator to
|
||||
@ -508,7 +508,9 @@ void Row::shortenIfNeeded(pos_type const keep, int const w)
|
||||
dim_.wid = wid + cit->dim.wid;
|
||||
// If there are other elements, they should be removed.
|
||||
elements_.erase(next(cit, 1), end);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -227,8 +227,9 @@ public:
|
||||
* remains is a large word, cut it to \param width.
|
||||
* \param body_pos minimum amount of text to keep.
|
||||
* \param width maximum width of the row
|
||||
* \return true if the row has been shortened.
|
||||
*/
|
||||
void shortenIfNeeded(pos_type const body_pos, int const width);
|
||||
bool shortenIfNeeded(pos_type const body_pos, int const width);
|
||||
|
||||
/**
|
||||
* If last element of the row is a string, compute its width
|
||||
|
@ -911,8 +911,10 @@ void TextMetrics::breakRow(Row & row, int const right_margin, pit_type const pit
|
||||
row.addVirtual(end, docstring(1, char_type(0x00B6)), f, Change());
|
||||
}
|
||||
|
||||
// if the row is too large, try to cut at last separator.
|
||||
row.shortenIfNeeded(body_pos, width);
|
||||
// if the row is too large, try to cut at last separator. In case
|
||||
// of success, reset indication that the row was broken abruptly.
|
||||
if (row.shortenIfNeeded(body_pos, width))
|
||||
row.right_boundary(false);
|
||||
|
||||
// make sure that the RTL elements are in reverse ordering
|
||||
row.reverseRTL(is_rtl);
|
||||
|
Loading…
Reference in New Issue
Block a user