[TC9.51] Compare by content - very long row,edit mode inaccessible

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
BORG52
Junior Member
Junior Member
Posts: 28
Joined: 2011-04-23, 16:16 UTC

[TC9.51] Compare by content - very long row,edit mode inaccessible

Post by *BORG52 »

Hello

1/Download file:
2/try "Compare by Content" downloaded secureboot.js with any other file or with a little changed secureboot.js
- "Edit mode" is always inaccessible

Problem is here:
search for string in securebot.js:
var asmCryptoSha256Js

Here is very long row with 28425 chars.
After reduce it to 16350 chars, "edit mode" is now accessible.

It is bug or feature?
TC 9.51
User avatar
Dalai
Power Member
Power Member
Posts: 9352
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: [TC9.51] Compare by content - very long row,edit mode inaccessible

Post by *Dalai »

This is not a bug:
TC help, Dialog box: Compare by content wrote:Compare
Starts the comparison between the two chosen files. If the two files are identical, this will be shown with a dialog box only. Otherwise the differences will be shown in the two text windows. Binary files will be shown in hexadecimal mode, and text files in text mode. Files up to 2 MB will be loaded completely into memory, so the originals will remain editable. Larger files will only be mapped to memory, i.e. they remain locked during the comparison.
The size value is the sum of both of the file's sizes, i.e. TC locks files if they're a little over 1 MB in size.

This can be adjusted with this parameter:
TC help, section 4.b), 1. Configuration wrote:MaxCompareSizeInMem=1048576
Compare by content: Size limit for files which are loaded completely in memory for comparison. Larger files are mapped into memory.

@Ghisler: Although it's not a bug, it's a question that comes up more often. I suggest to add another hint to the help file explaining that Edit mode won't be available when the files are locked, because not everybody can make that connection or come to that conclusion.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
elgonzo
Power Member
Power Member
Posts: 866
Joined: 2013-09-04, 14:07 UTC

Re: [TC9.51] Compare by content - very long row,edit mode inaccessible

Post by *elgonzo »

2Dalai
No, wrong rabbit hole :)

The file BORG52 has problems with is just approx. 214 KB in size. Just did a quick test (two files with 17 KB each, so in total only ~34 KB), it really seems to be about the line length. Go beyond a line length of somewhere between 16000 and 17000 characters (or perhaps bytes? I haven't tested with multi-byte characters), and no edit mode for ya...

It still seems to be a limitation though. If you compare two almost identical files with such very long lines, where only a few characters differ between the very long line(s) of the file, the file compare tool is not able to only highlight the differing characters, but highlights the whole very long line as different.

I find it curious, though, that the edit mode is disabled even though the viewer/editor component can still render the entire very long lines without issues, as it seems. The diff highlighting being limited should not affect the function of the editor, no?
Begrudgingly back to Windows... now 11... sigh... but i have no nerve for Linux desktop anymore...
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: [TC9.51] Compare by content - very long row,edit mode inaccessible

Post by *Usher »

elgonzo wrote: 2021-02-07, 12:49 UTC Go beyond a line length of somewhere between 16000 and 17000 characters (or perhaps bytes? I haven't tested with multi-byte characters), and no edit mode for ya...
It's 16 KiB buffer size limit. Many text editors allow even smaller line length so it's definitely not a bug. Results of editing such a file may be unexpected from users' point of view, so it's more safe to open it in read-only mode.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Dalai
Power Member
Power Member
Posts: 9352
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: [TC9.51] Compare by content - very long row,edit mode inaccessible

Post by *Dalai »

2elgonzo
You're right. Still, adding information about file size, and line length for that matter, to the help file would be a good idea. Maybe a section dedicated to "Edit mode" and when and why it's disabled/unavailable.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC9.51] Compare by content - very long row,edit mode inaccessible

Post by *ghisler(Author) »

Mapping to memory isn't the problem here, it's because of the extremely long line. Comparison within a line becomes slower and slower, the longer the line is. I had to set a limit where the lines are not compared any more, and also can't be edited.
Author of Total Commander
https://www.ghisler.com
Post Reply