Compare by Content, issues with selection while editing

Moderators: Hacker, petermad, Stefan2, white

Post Reply
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Compare by Content, issues with selection while editing

Post by *browny »

TC 11.51 64-bit in Windows 11.
Let's say, the goal was to delete matching lines and keep different.
After deleting a line, the tool immediately rearranges panes and therefore it is necessary to select matching lines first, then delete.

Left file:

Code: Select all

a
b
c
Right file:

Code: Select all

a
c
No new line after c in both files.

Enter Edit mode.
Use Shift+Down to be sure that selection contains the whole lines, including new line characters.

1. Select the first line on the left, press Tab to get to the right pane, select the first line on the right.
If Delete was pressed, the first line would be removed, but also an undesirable empty line would be inserted.

With the original files, trying to avoid this additional empty line.
2. Select the first line on the left, press Tab to get to the right pane, select both the first line and the dummy empty line.
Now press Shift+Tab to return to the left, then Delete to remove the selected line.
The dummy empty line in the right pane is gone now, but selection contains both a and c lines. This is wrong.
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Re: Compare by Content, issues with selection while editing

Post by *browny »

Two source files, the right one has an additional function inserted somewhere in the middle (60+ lines long).
Double clicking on comment lines containing /* to make selections - in the right pane it is below the inserted function.
Then using Resync comparison... to get the expected 1 difference.
Now, the left selection is gone, but the right one persists and was seen about 15 lines below the original place of selection.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Compare by Content, issues with selection while editing

Post by *ghisler(Author) »

I have checked this now:
1. I think it's a good idea to handle this differently: Currently pressing delete on a selection of lines removes those lines and brings the characters behind the selection to the first line. Total Commander doesn't distinguish between an empty line and a placeholder line in this case, so you get an empty line. In your example, the last line of the selection is just a placeholder, so it's better to make the first line a placeholder after "del".

2. The selection in the other panel isn't currently updated when making changes in the active panel. I will try to do this. The selection isn't part of the text, it's stored as "line a character b to line c character d". So when the lines are moved, the selection would have to be moved too.

Your second message describes the same problem as 2. I will try to move the selection with the text. But since the recomparison can tear the lines apart, I will have to reduce the selection to one line.
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Re: Compare by Content, issues with selection while editing

Post by *browny »

The case in the second message was described because selection moved by a fraction of the inserted function size.
Initially there were many differences with a few empty placeholder lines.
My unverified guess was that the shift could be related to the count of placeholders in the span between the selection lines; but this is irrelevant now.
browny
Senior Member
Senior Member
Posts: 359
Joined: 2007-09-10, 13:19 UTC

Re: Compare by Content, issues with selection while editing

Post by *browny »

A menu item "Delete selections on both sides" could make certain things a lot easier.
Would you like a request in TC suggestions?
Post Reply