TortoiseMerge, paste multiline + undo doesn't restore line numbers correctly

7 views
Skip to first unread message

Daniel Sahlberg

unread,
Nov 26, 2022, 12:39:40 PM11/26/22
to TortoiseSVN-dev
Hi,

In TortoiseMerge:
- Look at a diff of a changed file, for example from double click in the commit dialog.
- Paste a few lines (it doesn't have to be related to the changed lines, in the attached image I pasted a few lines in the beginning of the file). TortoiseMerge correctly renumbers all lines.
- Undo (Ctrl-Z). TortoiseMerge removes the pasted lines but doesn't renumber the following lines. See attached picture with lines 1 5 6 7 etc.

If I understand the code correctly, the line numbering is stored in the undo list so I propose to move the call to UpdateViewLineNumbers() above SaveUndoStep(), as follows.

[[[
Index: BaseView.cpp
===================================================================
--- BaseView.cpp    (revision 29481)
+++ BaseView.cpp    (working copy)
@@ -6765,9 +6765,9 @@
         {
             m_pwndBottom->InsertViewEmptyLines(nViewLine + 1, nLinesToPaste - 1);
         }
+        UpdateViewLineNumbers();
         SaveUndoStep();
 
-        UpdateViewLineNumbers();
         CUndo::GetInstance().EndGrouping();
 
         ptCaretViewPos = SetupPoint(lines[nLinesToPaste - 1LL].GetLength(), nInsertLine);
]]]

Another solution would be to add another SaveUndoStep() after UpdateViewLineNumbers().

Is this analysis correct or do I miss something? Which version is preferred?

/Daniel

TortoiseMerge wrong line numbers.png

Stefan

unread,
Nov 29, 2022, 11:14:56 AM11/29/22
to TortoiseSVN-dev
this patch looks fine. 
I prefer this solution, because adding another SaveUndoStep() would cause quite a few other problems.

Stefan

Daniel Sahlberg

unread,
Nov 29, 2022, 4:12:59 PM11/29/22
to TortoiseSVN-dev
Thanks. Committed r29487.
/Daniel

Reply all
Reply to author
Forward
0 new messages