Make previous/next difference in Compare contents start from the current cursor position

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

browny
Senior Member
Senior Member
Posts: 442
Joined: 2007-09-10, 13:19 UTC

Make previous/next difference in Compare contents start from the current cursor position

Post by *browny »

Two files, lets say the right one has all ten lines with single digits from 0 to 9, left has only even numbers.
Of course, comparison shows empty lines on the left where numbers are missing.
Turn on Edit mode, press Ctrl+Home to go to the top, then use Alt+Down Alt+Right combinations to advance to next difference and copy left to right.
Second Alt+Down would skips one differece while it should not (goes from line with "2" to line with "5" instead of "3").
"Next difference" button does the same.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53126
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Next in Compare tool may skip real "next"

Post by *ghisler(Author) »

The compare tool counts multiple linked lines of differences as one difference. So if lines 2,3 and 5 are different, lines 2+3 are counted as one difference, and line 5 as the next.
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 442
Joined: 2007-09-10, 13:19 UTC

Re: Next in Compare tool may skip real "next"

Post by *browny »

Line numbering stays unchanged between comparisons, so lets refer to the numbers as "left/right"
Initially, there are 5 differences - all odd numbers at lines -/2, -/4, -/6, -/8, -/10.
Equal are lines 1/1, 2/3, 3/5, 4/7, 5/9.
The topmost difference is at -/2 (digit 1), and after elimination the cursor is at equal line 2/3 (digit 2), which is above the next highlighted difference at -/4.
The natural way to advance down would be landing on the highlighted difference below the current line, which is -/4 and not -/6.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53126
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Next in Compare tool may skip real "next"

Post by *ghisler(Author) »

I have tried to reproduce this, but I can't. My two files are (left all numbers, right only even numbers as stated):
Left file:

Code: Select all

0
1
2
3
4
5
6
7
8
9
10
and right file:

Code: Select all

0
2
4
6
8
10
Resulting comparison:
https://www.ghisler.ch/images/compare_odd_even.png

Pressing "n" jumps through all the numbers. What am I doing wrong?
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 442
Joined: 2007-09-10, 13:19 UTC

Re: Next in Compare tool may skip real "next"

Post by *browny »

ghisler(Author) wrote: 2026-06-10, 07:28 UTC What am I doing wrong?
Simple. Your configuration:
ghisler(Author) wrote: 2026-06-10, 07:28 UTC My two files are (left all numbers, right only even numbers as stated):
Stated was different:
Two files, lets say the right one has all ten lines with single digits from 0 to 9, left has only even numbers.
Right, not left. With your mirrored files, keys in Edit mode should have been Alt+Down Alt+Left.
ghisler(Author) wrote: 2026-06-10, 07:28 UTC Pressing "n" jumps through all the numbers.
Have you switched to Edit mode and changed files as described? The bug is seen in changed files.
Mockup of what happens here after the first replacement before Next difference:

Code: Select all

1:0 | 1:0 <-- equal
2:2 | 3:2 <-- equal, cursor is here
    | 4:3 <-- highlighted difference, real next
3:4 | 5:4 <-- equal
    | 6:5 <-- here jumps on Next difference
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53126
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Next in Compare tool may skip real "next"

Post by *ghisler(Author) »

Right, not left.
Even if I swap the two files, I can go through all the results with Alt+N, and none is skipped.

Something with your files mist be different.
Could you post your two files in [ code ] [ /code ] blocks, please?
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 442
Joined: 2007-09-10, 13:19 UTC

Re: Next in Compare tool may skip real "next"

Post by *browny »

File "0", left

Code: Select all

0
2
4
6
8
File "1", right

Code: Select all

0
1
2
3
4
5
6
7
8
9
Settings: not Binary, ANSI-ANSI, Case sensitive marked, tried with two next checkboxes both marked or unmarked.
Cursor initially is in the left pane.
Actions: press Alt+M, Ctrl+Home, hold Alt and press Down, Right, Down.
Now active difference in the line with "5" instead of expected "3".

Previous versions of TC did the same, now it is TC 11.58 RC2 64-bit in the updated Windows 11 25H2.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53126
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Next in Compare tool may skip real "next"

Post by *ghisler(Author) »

I will try it, thanks!
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 17375
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Next in Compare tool may skip real "next"

Post by *petermad »

I can confirm that after I press Alt+down the cursor is between line 1 and 2 on the left side (on line 2 on the right side) and when I press Alt+Right line 2 in the right side is removed, and the next press on Alt+Down highlights line 5 in the right side and not line 3 as should be expected.

Maybe I is connected to the fact that if I press Alt-down and then manually move the cursor up to a previous line, then the next Alt-down press will go to the next difference from the previous last difference, not from the current cursor position - to illustrate that with the test files: press Alt+down (the cursor goes to the line between 2 and 4 in the left side). Now click on the first line (or press Ctrl+home) and press Alt+down again - the cursor goes between line 3 and 4 - not between 2 and 4.. Now click on the first line again and press Alt+down - now the cursor goes between line 4 and 5.

In my opinion pressing Alt+down should go to the next difference from the CURRENT cursor position, not to the next difference from the cursor position of the last difference. If that was changed, maybe browny's problem would be fixed too?
License #524 1994
Danish TC Translator
TC 11.58rc3 32+64bit on Windows XP 32bit & Windows 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1415b
TC 3.62 on Android 6, 13, 15 & 16
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Galizza
Senior Member
Senior Member
Posts: 271
Joined: 2018-09-07, 05:21 UTC
Location: Galiza (Spain)

Re: Next in Compare tool may skip real "next"

Post by *Galizza »

browny wrote: 2026-06-10, 11:02 UTC Now active difference in the line with "5" instead of expected "3"

Previous versions of TC did the same, now it is TC 11.58 RC2 64-bit in the updated Windows 11 25H2.
Confirmed, TC 11.57 32Bit // Windows 11 25H2
 
 Looking through a glass onion
 
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53126
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Next in Compare tool may skip real "next"

Post by *ghisler(Author) »

Sorry, this is not how "Next/Previous difference" works. The next difference found only partially depends on the cursor position:
1. If the last found difference is outside of the current view, "Next/Previous difference" starts searching from the first line
2. Otherwise, it starts searching from the last found difference position

Changing this to start from the current cursor position would be a major change, which I'm currently not willing to make.

Moderator message from: ghisler(Author) » 2026-06-11, 07:51 UTC

Moved to will not be changed
Author of Total Commander
https://www.ghisler.com
browny
Senior Member
Senior Member
Posts: 442
Joined: 2007-09-10, 13:19 UTC

Re: Next in Compare tool may skip real "next"

Post by *browny »

ghisler(Author) wrote: 2026-06-11, 07:51 UTC 1. If the last found difference is outside of the current view, "Next/Previous difference" starts searching from the first line
2. Otherwise, it starts searching from the last found difference position
The last found difference had been deleted, difference position is invalidated, so the logical choice would be - continue from the current line.
JOUBE
Power Member
Power Member
Posts: 1926
Joined: 2004-07-08, 08:58 UTC

Re: Next in Compare tool may skip real "next"

Post by *JOUBE »

ghisler(Author) wrote: 2026-06-11, 07:51 UTC Sorry, this is not how "Next/Previous difference" works. The next difference found only partially depends on the cursor position:
1. If the last found difference is outside of the current view, "Next/Previous difference" starts searching from the first line
2. Otherwise, it starts searching from the last found difference position

Changing this to start from the current cursor position would be a major change, which I'm currently not willing to make.
ghisler(Author) wrote:2026-06-11, 07:51 UTCMoved to will not be changed
2ghisler(author)Thank you for those clear words, which would also like to see in other threads. Please keep it up.
browny
Senior Member
Senior Member
Posts: 442
Joined: 2007-09-10, 13:19 UTC

Re: Next in Compare tool may skip real "next"

Post by *browny »

Not the first time when deleted lines in Compare tool were causing troubles.

The existing behaviour is counterintuitive, it differs from what could be seen in other next/previous cases, and certainly is not the best way to handle the situation.
Deletion of several consecutive differences now requires much more attention and twice more key presses.
This could be moved into Suggestions, instead of being dumped.
User avatar
petermad
Power Member
Power Member
Posts: 17375
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Next in Compare tool may skip real "next"

Post by *petermad »

browny wrote: 2026-06-12, 10:37 UTCThis could be moved into Suggestions, instead of being dumped.
 

Moderator message from: petermad » 2026-06-12, 10:41 UTC

Moved to "TC suggestions (English)" from "TC Behaviour which will not be changed"
 
 
2browny
I have changed the topic title to "Make previous/next difference in Compare contents start from the current cursor position" - If you can not agree with that, then please change it yourself.
License #524 1994
Danish TC Translator
TC 11.58rc3 32+64bit on Windows XP 32bit & Windows 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1415b
TC 3.62 on Android 6, 13, 15 & 16
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply