[LyX/master] Correctly show deleted url with change tracking

Enrico Forestieri forenr at lyx.org
Wed Feb 17 18:49:15 UTC 2021


commit 2fdee24959fccd80899f1d3eaf772b7d53317f77
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Wed Feb 17 19:51:01 2021 +0100

    Correctly show deleted url with change tracking
    
    This fixes the issue reported here:
    https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg202545.html
    
    I could not find an open ticket about it.
---
 src/Paragraph.cpp      |    9 ++++++---
 src/insets/InsetFlex.h |    2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index aca858c..22dcdb6 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -2515,7 +2515,9 @@ void Paragraph::latex(BufferParams const & bparams,
 	// Do we have an open font change?
 	bool open_font = false;
 
-	Change runningChange = Change(Change::UNCHANGED);
+	Change runningChange =
+	    runparams.inDeletedInset && !inInset().canTrackChanges()
+	    ? runparams.changeOfDeletedInset : Change(Change::UNCHANGED);
 
 	Encoding const * const prev_encoding = runparams.encoding;
 
@@ -3050,8 +3052,9 @@ void Paragraph::latex(BufferParams const & bparams,
 		os << "{\\" << font.latexSize() << "\\par}";
 	}
 
-	column += Changes::latexMarkChange(os, bparams, runningChange,
-					   Change(Change::UNCHANGED), runparams);
+	if (!runparams.inDeletedInset || inInset().canTrackChanges())
+		column += Changes::latexMarkChange(os, bparams, runningChange,
+					Change(Change::UNCHANGED), runparams);
 
 	// Needed if there is an optional argument but no contents.
 	if (body_pos > 0 && body_pos == size()) {
diff --git a/src/insets/InsetFlex.h b/src/insets/InsetFlex.h
index 527974a..f7ea07a 100644
--- a/src/insets/InsetFlex.h
+++ b/src/insets/InsetFlex.h
@@ -40,6 +40,8 @@ public:
 	///
 	bool hasSettings() const override { return false; }
 	///
+	bool canTrackChanges() const override { return name_ != "URL"; }
+	///
 	bool getStatus(Cursor & cur, FuncRequest const & cmd,
 		FuncStatus &) const override;
 	///


More information about the lyx-cvs mailing list