Page 1 of 1

TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-19, 11:30 UTC
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.

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-19, 11:43 UTC
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.

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-19, 12:11 UTC
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!

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-20, 08:30 UTC
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*/

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-20, 09:01 UTC
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: ./,:"

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-20, 10:00 UTC
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 */

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-20, 10:24 UTC
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.

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-20, 11:45 UTC
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

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-20, 12:30 UTC
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 :)

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-22, 07:27 UTC
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.

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-22, 12:39 UTC
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 :)

Re: TC 11.02 RC3: CompareSkipLineNumbers

Posted: 2023-10-25, 16:06 UTC
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.