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

Skip to first unread message

Daniel Sahlberg

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

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();
-        UpdateViewLineNumbers();
         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?


TortoiseMerge wrong line numbers.png


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.


Daniel Sahlberg

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

Reply all
Reply to author
0 new messages