diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES index 30e294840d..3fa80abe7a 100644 --- a/lib/RELEASE-NOTES +++ b/lib/RELEASE-NOTES @@ -35,6 +35,9 @@ * \ct_additions_underlined true|false: determines whether additions in change tracking are underlined in the workarea (default: true). +* \ct_markup_copied true|false: determines whether change tracking markup should be + preserved on copy/paste (default: false). + !!!The following pref variables were changed in 2.4: diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx index a514d0c21c..3ee3df489e 100644 --- a/lib/doc/UserGuide.lyx +++ b/lib/doc/UserGuide.lyx @@ -1,5 +1,5 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 591 +\lyxformat 592 \begin_document \begin_header \save_transient_properties true @@ -8485,14 +8485,12 @@ Verbatim \end_layout \begin_layout Verbatim - This is Verbatim. \end_layout \begin_layout Verbatim \noindent \align block - The following 2 lines are empty: \end_layout @@ -8505,7 +8503,6 @@ The following 2 lines are empty: \end_layout \begin_layout Verbatim - Almost everything is allowed in Verbatim:"%&$§#~'` \backslash }][{| @@ -8529,7 +8526,6 @@ Verbatim \end_layout \begin_layout Verbatim* - This is Verbatim*. \end_layout @@ -48920,6 +48916,29 @@ Ctrl+arrow key \family default the cursor jumps from the end of a word to the end of the next word. Normally it jumps from the beginning to the beginning. +\change_inserted -712698321 1578924606 + +\end_layout + +\begin_layout Standard + +\change_inserted -712698321 1578924785 +The option +\family sans +Keep change tracking markup on copy and paste +\family default + is for users who don't want tracked changes to be dissolved on copy and + paste operations (i. +\begin_inset space \thinspace{} +\end_inset + +e., inserted as new text with the deletions removed). + If this is checked, the change-tracked text will be copied and pasted as + is, independent if changes are currently tracked or not. + This also applies to wrapping to\SpecialChar breakableslash +dissolving from insets. +\change_unchanged + \end_layout \begin_layout Standard diff --git a/lib/doc/de/UserGuide.lyx b/lib/doc/de/UserGuide.lyx index 4d74e2e60c..408ca50e20 100644 --- a/lib/doc/de/UserGuide.lyx +++ b/lib/doc/de/UserGuide.lyx @@ -1,5 +1,5 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 591 +\lyxformat 592 \begin_document \begin_header \save_transient_properties true @@ -8638,10 +8638,12 @@ Unformatiert \end_layout \begin_layout Verbatim + Dies ist Unformatiert. \end_layout \begin_layout Verbatim + Die folgenden 2 Zeilen sind leer: \end_layout @@ -8654,6 +8656,7 @@ Die folgenden 2 Zeilen sind leer: \end_layout \begin_layout Verbatim + Fast alles ist in Unformatiert erlaubt:"%&$§#~'` \backslash }][{| @@ -8677,6 +8680,7 @@ Unformatiert \end_layout \begin_layout Verbatim* + Dies ist Unformatiert*. \end_layout @@ -46114,6 +46118,24 @@ Cursornavigation zwischen Wörtern im Mac-Stil Normalerweise springt er von Anfang zu Anfang. \end_layout +\begin_layout Standard +Die Option +\family sans +Änderungsmarkierungen beim Kopieren und Einfügen behalten +\family default + können Sie auswählen, wenn Sie nicht möchten, dass verfolgte Änderungen + beim Kopieren und Einfügen aufgelöst werden (d. +\begin_inset space \thinspace{} +\end_inset + +h., dass als gelöscht markierter Text entfernt und alles andere als neu eingefügt + wird). + Wenn dies ausgewählt ist, wird der kopierte Text mit den Markierungen eingefügt +, unabhängig davon, ob Änderungen gerade verfolgt werden oder nicht. + Das betrifft auch das Umwandeln von Text in\SpecialChar breakableslash +von Einfügungen. +\end_layout + \begin_layout Standard Die Option \family sans diff --git a/lib/scripts/prefs2prefs_prefs.py b/lib/scripts/prefs2prefs_prefs.py index 1eac80cde3..6bbb8ac0bc 100644 --- a/lib/scripts/prefs2prefs_prefs.py +++ b/lib/scripts/prefs2prefs_prefs.py @@ -125,6 +125,10 @@ # Add ct_additions_underlined. # No convergence necessary. +# Incremented to format 32, by spitz +# Add ct_markup_copied. +# No convergence necessary. + # NOTE: The format should also be updated in LYXRC.cpp and # in configure.py. @@ -474,5 +478,6 @@ conversions = [ [ 28, [remove_date_insert_format]], [ 29, [remove_use_pixmap_cache]], [ 30, []], - [ 31, []] + [ 31, []], + [ 32, []] ] diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 4101933851..8e0a72d6dd 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -287,8 +287,9 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist, tmpbuf->eraseChar(i--, false); } - tmpbuf->setChange(Change(buffer.params().track_changes ? - Change::INSERTED : Change::UNCHANGED)); + if (lyxrc.ct_markup_copied) + tmpbuf->setChange(Change(buffer.params().track_changes ? + Change::INSERTED : Change::UNCHANGED)); } bool const empty = pars[pit].empty(); @@ -606,7 +607,8 @@ Buffer * copyToTempBuffer(ParagraphList const & paragraphs, DocumentClassConstPt void putClipboard(ParagraphList const & paragraphs, - DocumentClassConstPtr docclass, docstring const & plaintext) + DocumentClassConstPtr docclass, docstring const & plaintext, + BufferParams const bp) { Buffer * buffer = copyToTempBuffer(paragraphs, docclass); if (!buffer) // already asserted in copyToTempBuffer() @@ -617,6 +619,12 @@ void putClipboard(ParagraphList const & paragraphs, // applications, the number that can parse it should go up in the future. buffer->params().html_math_output = BufferParams::MathML; + if (lyxrc.ct_markup_copied) { + // Copy authors to the params. We need those pointers. + for (Author const & a : bp.authors()) + buffer->params().authors().record(a); + } + // Make sure MarkAsExporting is deleted before buffer is { // The Buffer is being used to export. This is necessary so that the @@ -711,10 +719,12 @@ void copySelectionHelper(Buffer const & buf, Text const & text, // do not copy text (also nested in insets) which is marked as // deleted, unless the whole selection was deleted - if (!isFullyDeleted(copy_pars)) - acceptChanges(copy_pars, buf.params()); - else - rejectChanges(copy_pars, buf.params()); + if (!lyxrc.ct_markup_copied) { + if (!isFullyDeleted(copy_pars)) + acceptChanges(copy_pars, buf.params()); + else + rejectChanges(copy_pars, buf.params()); + } // do some final cleanup now, to make sure that the paragraphs @@ -950,7 +960,7 @@ void cutSelectionHelper(Cursor & cur, CutStack & cuts, bool realcut, bool putcli // Even if there is no selection. if (putclip) putClipboard(cuts[0].first, cuts[0].second, - cur.selectionAsString(true, true)); + cur.selectionAsString(true, true), bp); } if (begpit != endpit) @@ -1027,7 +1037,7 @@ void copyInset(Cursor const & cur, Inset * inset, docstring const & plaintext) theCuts.push(make_pair(pars, bp.documentClassPtr())); // stuff the selection onto the X clipboard, from an explicit copy request - putClipboard(theCuts[0].first, theCuts[0].second, plaintext); + putClipboard(theCuts[0].first, theCuts[0].second, plaintext, bp); } @@ -1110,7 +1120,8 @@ void copySelection(Cursor const & cur, docstring const & plaintext) } // stuff the selection onto the X clipboard, from an explicit copy request - putClipboard(theCuts[0].first, theCuts[0].second, plaintext); + putClipboard(theCuts[0].first, theCuts[0].second, plaintext, + cur.buffer()->params()); } @@ -1162,8 +1173,8 @@ docstring selection(size_t sel_index, DocumentClassConstPtr docclass) void pasteParagraphList(Cursor & cur, ParagraphList const & parlist, - DocumentClassConstPtr docclass, ErrorList & errorList, - cap::BranchAction branchAction) + DocumentClassConstPtr docclass, ErrorList & errorList, + cap::BranchAction branchAction) { if (cur.inTexted()) { Text * text = cur.text(); diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 7b7b262710..f7c085c64c 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -61,7 +61,7 @@ namespace { // The format should also be updated in configure.py, and conversion code // should be added to prefs2prefs_prefs.py. -static unsigned int const LYXRC_FILEFORMAT = 31; // lasgouttes: add \ct_additions_underlined +static unsigned int const LYXRC_FILEFORMAT = 32; // spitz: add \ct_markup_copied // when adding something to this array keep it sorted! LexerKeyword lyxrcTags[] = { { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND }, @@ -93,6 +93,7 @@ LexerKeyword lyxrcTags[] = { { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE }, { "\\copier", LyXRC::RC_COPIER }, { "\\ct_additions_underlined", LyXRC::RC_CT_ADDITIONS_UNDERLINED }, + { "\\ct_markup_copied", LyXRC::RC_CT_MARKUP_COPIED }, { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR }, { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH }, { "\\def_file", LyXRC::RC_DEFFILE }, @@ -676,6 +677,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) lexrc >> ct_additions_underlined; break; + case RC_CT_MARKUP_COPIED: + lexrc >> ct_markup_copied; + break; + case RC_CURSOR_FOLLOWS_SCROLLBAR: lexrc >> cursor_follows_scrollbar; break; @@ -1601,6 +1606,16 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; // fall through + case RC_CT_MARKUP_COPIED: + if (ignore_system_lyxrc || + ct_markup_copied + != system_lyxrc.ct_markup_copied) { + os << "\\ct_markup_copied " + << convert(ct_markup_copied) << '\n'; + } + if (tag != RC_LAST) + break; + // fall through case RC_CURSOR_FOLLOWS_SCROLLBAR: if (ignore_system_lyxrc || cursor_follows_scrollbar @@ -2771,6 +2786,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_CONVERTER_CACHE_MAXAGE: case LyXRC::RC_COPIER: case LyXRC::RC_CT_ADDITIONS_UNDERLINED: + case LyXRC::RC_CT_MARKUP_COPIED: case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR: case LyXRC::RC_SCROLL_BELOW_DOCUMENT: case LyXRC::RC_GUI_LANGUAGE: diff --git a/src/LyXRC.h b/src/LyXRC.h index 1ae79b0500..ed7511a6d1 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -67,6 +67,7 @@ public: RC_CONVERTER_CACHE_MAXAGE, RC_COPIER, RC_CT_ADDITIONS_UNDERLINED, + RC_CT_MARKUP_COPIED, RC_CURSOR_FOLLOWS_SCROLLBAR, RC_CURSOR_WIDTH, RC_DEFAULT_DECIMAL_SEP, @@ -422,6 +423,8 @@ public: /// bool ct_additions_underlined = true; /// + bool ct_markup_copied = false; + /// bool scroll_below_document = false; /// enum MacroEditStyle { diff --git a/src/Text.cpp b/src/Text.cpp index b29e002a49..dc296384b2 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -1813,8 +1813,9 @@ bool Text::dissolveInset(Cursor & cur) // but we'll try the cheaper solution here. cur.buffer()->clearReferenceCache(); - // Do not revive deleted text - lyx::acceptChanges(plist, b.params()); + if (!lyxrc.ct_markup_copied) + // Do not revive deleted text + lyx::acceptChanges(plist, b.params()); // ERT paragraphs have the Language latex_language. // This is invalid outside of ERT, so we need to diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp index abd9ff4013..6ba54e3d21 100644 --- a/src/frontends/qt/GuiPrefs.cpp +++ b/src/frontends/qt/GuiPrefs.cpp @@ -2746,6 +2746,8 @@ PrefEdit::PrefEdit(GuiPreferences * form) this, SIGNAL(changed())); connect(macLikeCursorMovementCB, SIGNAL(clicked()), this, SIGNAL(changed())); + connect(copyCTMarkupCB, SIGNAL(clicked()), + this, SIGNAL(changed())); connect(sortEnvironmentsCB, SIGNAL(clicked()), this, SIGNAL(changed())); connect(groupEnvironmentsCB, SIGNAL(clicked()), @@ -2776,6 +2778,7 @@ void PrefEdit::applyRC(LyXRC & rc) const rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked(); rc.scroll_below_document = scrollBelowCB->isChecked(); rc.mac_like_cursor_movement = macLikeCursorMovementCB->isChecked(); + rc.ct_markup_copied = copyCTMarkupCB->isChecked(); rc.sort_layouts = sortEnvironmentsCB->isChecked(); rc.group_layouts = groupEnvironmentsCB->isChecked(); switch (macroEditStyleCO->currentIndex()) { @@ -2799,6 +2802,7 @@ void PrefEdit::updateRC(LyXRC const & rc) cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); scrollBelowCB->setChecked(rc.scroll_below_document); macLikeCursorMovementCB->setChecked(rc.mac_like_cursor_movement); + copyCTMarkupCB->setChecked(rc.ct_markup_copied); sortEnvironmentsCB->setChecked(rc.sort_layouts); groupEnvironmentsCB->setChecked(rc.group_layouts); macroEditStyleCO->setCurrentIndex(rc.macro_edit_style); diff --git a/src/frontends/qt/ui/PrefEditUi.ui b/src/frontends/qt/ui/PrefEditUi.ui index 2db2dd6b64..69aa6f5bde 100644 --- a/src/frontends/qt/ui/PrefEditUi.ui +++ b/src/frontends/qt/ui/PrefEditUi.ui @@ -1,3 +1,4 @@ + PrefEditUi @@ -5,8 +6,8 @@ 0 0 - 385 - 435 + 494 + 583 @@ -31,6 +32,33 @@ true + + + + Scroll &below end of document + + + + + + + Sort &environments alphabetically + + + + + + + Qt::Horizontal + + + + 200 + 20 + + + + @@ -71,23 +99,23 @@ - - + + Qt::Horizontal - 200 + 40 20 - - + + - Scroll &below end of document + &Group environments by their category @@ -101,21 +129,7 @@ - - - - Sort &environments alphabetically - - - - - - - &Group environments by their category - - - - + @@ -134,18 +148,15 @@ - - - - Qt::Horizontal + + + + If this is checked, deleted and added text in change tracking mde will not be resolved on copy/paste operations and when moving content from/to insets - - - 40 - 20 - + + &Keep change tracking markup on copy and paste - +