TC 11.02 RC3: CompareSkipLineNumbers

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
790
Junior Member
Junior Member
Posts: 30
Joined: 2009-04-22, 18:27 UTC
Location: Saint-Petersburg.RU

TC 11.02 RC3: CompareSkipLineNumbers

Post by *790 »

Why only "Numbers"?
Example:
I have two *.css stylesheet text files. There are “commented” lines that start with “/* ” and the same “uncommented” lines that start with @. If the difference is the presence of "/* " at the beginning of the line only, then such lines do not interest me. I want too skip this lines.
I have interest only for those lines where there are some other differences.
Win10x64, TC 11.02
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *AntonyD »

To be honest, it is very interesting - based on what user requests this new option was introduced.
It seems that no one on the forum asked for anything like this. And here “like” should be read as “literality”!
Because there were requests to implement a customizable option. Or line numbers, or first characters, +etc.
But that's exactly what it is - customizable on the user's side. And here some numbers are simply ignored...
Nothing is clear - I can’t even find a real example of such input.
#146217 personal license
790
Junior Member
Junior Member
Posts: 30
Joined: 2009-04-22, 18:27 UTC
Location: Saint-Petersburg.RU

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *790 »

Example of comparing:
(left text1| right text2)

Code: Select all

1 /* @[textcode] | /* @[textcode] 
2 /* @[textcode] | @[textcode]
3 @[textcode] | /* @[textcode]
4 /* @[textcode]anydifference[textcode] | /* @[textcode][textcode]
5 @[textcode]anydifference[textcode] | /* @[textcode]
6  /* @[textcode] | @[textcode]anydifference[textcode]
remarks:
1st line - text is equal, skip it.
2nd line - the difference is only in fist '/* ', skip it.
3d line - the difference is only in fist '/* ', skip it.
4-6 lines - the difference is not only in fist '/* ', show it!
Win10x64, TC 11.02
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *ghisler(Author) »

It seems that no one on the forum asked for anything like this.
It was requested via e-mail. Since it was very easy to add, but is very special interest, I added it as an option to the wincmd.ini only.

Skipping comments, on the other hand, would be very hard to implement, because
- they are different between programming languages
- they can span several lines
- some languages support multiple types, e.g. C/C++ supports

Code: Select all

// this is a single line comment
/*This line is also a comment. // and this isn't a separate comment
It can span multiple lines*/
Author of Total Commander
https://www.ghisler.com
790
Junior Member
Junior Member
Posts: 30
Joined: 2009-04-22, 18:27 UTC
Location: Saint-Petersburg.RU

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *790 »

I'm not talking about improvements for special programs. I'm talking about general things like "Method for comparing within a line: 3 Find inserted text only at user-defined separators: ./,:" (of course, with checkbox "Show only differences..")
I suggest new "Sync method 4: Skip lines that start with user-defined signs: ./,:"
and accordingly: Edit user-defined separators

Sorry for the off topic...

P.S. Maybe, need "Sync method X: Find lines that start with user-defined signs: ./,:"
Win10x64, TC 11.02
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *ghisler(Author) »

I suggest new "Sync method 4: Skip lines that start with user-defined signs: ./,:"
Unfortunately it's not that simple. This would not skip multi-line comments like

Code: Select all

/* This is a comment
continued on line 2
continued on line 3 */
Author of Total Commander
https://www.ghisler.com
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *AntonyD »

But why did a single example, where ONLY initial numbers are processed (by the way, is their format taken into account? 123 or 12.25 or 133,255 or 13 455?) - suddenly became so important - relative to the more logical (although more complex in execution) generalized version described colleague above?
After all, in reality there are many more cases when you need to cut off SOMETHING at the beginning than just STRICT numbers.

About your example. It does not fit the required functionality))))
The second line does NOT start with the characters described! The triggering condition is not to support different kinds of comments for different languages, but for the characters that come first: for EACH line separately.
#146217 personal license
User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *Hacker »

Christian,
This would not skip multi-line comments
I think that is completely acceptable. Such a complex functionality is not part of this request.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
790
Junior Member
Junior Member
Posts: 30
Joined: 2009-04-22, 18:27 UTC
Location: Saint-Petersburg.RU

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *790 »

Hacker wrote: 2023-10-20, 11:45 UTCSuch a complex functionality is not part of this request.
I`m sorry for this offtop. Can you move this topic to ...?

I`m not talking about 'comment' only. Any user-defined characters...
For the first test, we can try how it will work for each line and don`t think about multi-lines :)
Win10x64, TC 11.02
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *ghisler(Author) »

So far there hasn't been any request where skipping such user-defined characters would be useful. Even for single line comments it wouldn't help much, because they can
1. start after a few spaces, so the rule couldn't be just "skip lines starting with a slash"
2. start after the actual code, which is very common for // style comments
3. be multi-character, e.g. Delphi uses both { comment } and (* comment *), but you can't skip lines starting with ( because they are used for other things like mathematical expressions

Examples:

Code: Select all

1:
             // comment
2:
  a=1;  // assign variable in C
3:
  a:=(1+a)*(2+b)*(3+c)*(4+d)*
       (5+e)*(6+f);
I'm not sure if even regular expressions could fully handle all such cases.
Author of Total Commander
https://www.ghisler.com
790
Junior Member
Junior Member
Posts: 30
Joined: 2009-04-22, 18:27 UTC
Location: Saint-Petersburg.RU

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *790 »

Ok, then it should not be "user-defined characters", but one "user-defined phrase (several characters)". The user knows what code language he is using, what lines he does not want to see compared and which phrases they have start :)
Win10x64, TC 11.02
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Re: TC 11.02 RC3: CompareSkipLineNumbers

Post by *Flint »

2ghisler(Author)
This feature could be very useful in many ways, which do not include comments at all. The CSS comment was just one simple example which, judging from this discussion, happened to to be so simple after all. OK, just forget about comments. But there are lots of other scenarios. For example, log files which start with date/time, which is usually of no relevance. And date/time can include digits, dots, colons, slashes, ampersands (depending on the locale); it also can be surrounded by brackets, separated from the actual message by a space, or a tab, and so on, and so forth. If you add an option for user-configurable list of symbols to ignore at the start of the line, it would be possible to configure this rule to exclude the date/time prefix and compare the real messages.

Another example: text as a numbered list, where each line starts with some designation like "1.2.4." If another item is added at the start, all the numbers will shift, and show as differences, even if the text remained the same. But with the suggested option the user would be able to configure the compare tool and exclude all those prefixes.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
Post Reply