Correctly track ulem commands with change tracking

LyX assumes that everything in \lyxdeleted is struck out by ulem
and increases the corresponding counter. However, deleted display
math material is struck out using tikz. As we also take into
account the deletion of underlined display math (in order to
properly position such material vertically), we have to take
care that the count is correct.
This commit is contained in:
Enrico Forestieri 2016-10-23 18:23:41 +02:00
parent 9ba76e6c40
commit dea5ba16de
4 changed files with 11 additions and 4 deletions

View File

@ -428,7 +428,7 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams,
// close \lyxadded or \lyxdeleted
os << '}';
column++;
if (oldChange.type == Change::DELETED)
if (oldChange.type == Change::DELETED && !runparams.wasDisplayMath)
--runparams.inulemcmd;
}
@ -440,7 +440,8 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams,
docstring macro_beg;
if (change.type == Change::DELETED) {
macro_beg = from_ascii("\\lyxdeleted{");
++runparams.inulemcmd;
if (!runparams.inDisplayMath)
++runparams.inulemcmd;
}
else if (change.type == Change::INSERTED)
macro_beg = from_ascii("\\lyxadded{");

View File

@ -23,7 +23,7 @@ OutputParams::OutputParams(Encoding const * enc)
moving_arg(false), intitle(false), inulemcmd(0), local_font(0), master_language(0),
encoding(enc), free_spacing(false), use_babel(false), use_polyglossia(false),
use_indices(false), use_japanese(false), linelen(0), depth(0),
exportdata(new ExportData), inDisplayMath(false),
exportdata(new ExportData), inDisplayMath(false), wasDisplayMath(false),
inComment(false), inTableCell(NO), inFloat(NONFLOAT),
inIndexEntry(false), inIPA(false), inDeletedInset(0),
changeOfDeletedInset(Change::UNCHANGED),

View File

@ -187,11 +187,16 @@ public:
*/
std::shared_ptr<ExportData> exportdata;
/** Whether we are inside a display math inset.
/** Whether we are entering a display math inset.
* Needed to correctly strike out deleted math in change tracking.
*/
mutable bool inDisplayMath;
/** Whether we are leaving a display math inset.
* Needed to correctly track nested ulem commands in change tracking.
*/
mutable bool wasDisplayMath;
/** Whether we are inside a comment inset. Insets that are including
* external files like InsetGraphics, InsetInclude and InsetExternal
* may only write the usual output and must not attempt to do

View File

@ -2389,6 +2389,7 @@ void Paragraph::latex(BufferParams const & bparams,
runparams);
}
runparams.wasDisplayMath = runparams.inDisplayMath;
runparams.inDisplayMath = false;
bool deleted_display_math = false;