mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Fix caption counter in longtables (see #8993).
This commit is contained in:
parent
4066d3818e
commit
e359d8f5ca
@ -172,6 +172,10 @@ public:
|
||||
bool isSubfloat() const { return subfloat_; }
|
||||
/// Set the state variable indicating whether we are in a subfloat.
|
||||
void isSubfloat(bool s) { subfloat_ = s; }
|
||||
/// Are we in a longtable?
|
||||
bool isLongtable() const { return longtable_; }
|
||||
/// Set the state variable indicating whether we are in a longtable.
|
||||
void isLongtable(bool s) { longtable_ = s; }
|
||||
|
||||
/// \name refstepcounter
|
||||
// @{
|
||||
@ -225,6 +229,8 @@ private:
|
||||
std::string current_float_;
|
||||
/// Are we in a subfloat?
|
||||
bool subfloat_;
|
||||
/// Are we in a longtable?
|
||||
bool longtable_;
|
||||
/// Used to keep track of active counters.
|
||||
std::vector<docstring> counter_stack_;
|
||||
/// Same, but for last layout.
|
||||
|
@ -404,7 +404,9 @@ void InsetCaption::updateBuffer(ParIterator const & it, UpdateType utype)
|
||||
docstring const labelstring = isAscii(lstring) ?
|
||||
master.B_(to_ascii(lstring)) : lstring;
|
||||
if (cnts.hasCounter(counter)) {
|
||||
cnts.step(counter, utype);
|
||||
// for longtables, we step the counter upstream
|
||||
if (!cnts.isLongtable())
|
||||
cnts.step(counter, utype);
|
||||
sec = cnts.theCounter(counter, lang);
|
||||
}
|
||||
if (labelstring != master.B_("standard")) {
|
||||
|
@ -3897,8 +3897,12 @@ void InsetTabular::updateBuffer(ParIterator const & it, UpdateType utype)
|
||||
// In a longtable, tell captions what the current float is
|
||||
Counters & cnts = buffer().masterBuffer()->params().documentClass().counters();
|
||||
string const saveflt = cnts.current_float();
|
||||
if (tabular.is_long_tabular)
|
||||
if (tabular.is_long_tabular) {
|
||||
cnts.current_float("table");
|
||||
// in longtables, we only step the counter once
|
||||
cnts.step(from_ascii("table"), utype);
|
||||
cnts.isLongtable(true);
|
||||
}
|
||||
|
||||
ParIterator it2 = it;
|
||||
it2.forwardPos();
|
||||
@ -3907,8 +3911,10 @@ void InsetTabular::updateBuffer(ParIterator const & it, UpdateType utype)
|
||||
buffer().updateBuffer(it2, utype);
|
||||
|
||||
//reset afterwards
|
||||
if (tabular.is_long_tabular)
|
||||
if (tabular.is_long_tabular) {
|
||||
cnts.current_float(saveflt);
|
||||
cnts.isLongtable(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user