Compare by Content, issues with selection while editing

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
browny
Senior Member
Senior Member
Posts: 367
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: 367
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: 50703
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: 367
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: 367
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?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50703
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Compare by Content, issues with selection while editing

Post by *ghisler(Author) »

This should be fixed in Total Commander 11.55 release candidate 1, please test it!
28.03.25 Fixed: Compare by content, edit mode, "Resync comparison from here": Keep selection on recompared lines, reduce to one selected line if it was multi-line (32/64)
28.03.25 Fixed: Compare by content: Backspace can now remove the first line if it is completely empty (32/64)
28.03.25 Fixed: Compare by content: When inserting or deleting a line in one pane, update the selection in the other when the line count changes there too (32/64)
27.03.25 Fixed: Compare by content: Don't leave an empty line when deleting a selection of multiple lines from the start of the first line to a placeholder line (empty without data, no line number) (32/64)
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 367
Joined: 2007-09-10, 13:19 UTC

Re: Compare by Content, issues with selection while editing

Post by *browny »

The issue seems to be fixed, thank you.

A minor visual oddity.
In the first example a line was selected on the left, then on the right.
Press Del to delete on the right side, and then press Tab.
There is a selection in place of the line number; both in the right and bottom panes.
This could be a feature though and not worth further fixing.

By the way, pretty posts count.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50703
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Compare by Content, issues with selection while editing

Post by *ghisler(Author) »

The issue seems to be fixed, thank you.
Great, thanks!
There is a selection in place of the line number; both in the right and bottom panes.
This always occurs when you focus the bottom 2 line panel. It's to indicate which was the last active side.
You can see this also when in the left panel and clicking on the bottom panel - then the current line number in the left panel and the top line in the bottom panel get highlighted too!

When you press TAB again to go to the top buttons, that selection goes away.
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 367
Joined: 2007-09-10, 13:19 UTC

Re: Compare by Content, issues with selection while editing

Post by *browny »

Pseudo-selection as an indication of active panel, and that this selection comes and goes are exactly the reasons of thingking it was abnormal.
In other topic it was also noted that selection is invisible if the lines were empty. This makes selection a poor indicator of active lines or panes.

Anyway, the main issues was resolved, the topic could be moved to fixed bugs.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50703
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Compare by Content, issues with selection while editing

Post by *ghisler(Author) »

Moderator message from: ghisler(Author) » 2025-05-19, 10:39 UTC

Moved to fixed bugs
Author of Total Commander
https://www.ghisler.com
Post Reply