"Edit mode" button inactive (greyed) in Compare by content

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
mattin
Junior Member
Junior Member
Posts: 9
Joined: 2021-01-02, 10:53 UTC

"Edit mode" button inactive (greyed) in Compare by content

Post by *mattin »

Hello,
I have strange case, when want compare 2 text files (.html being more accurate) I see them in both panels, can click button "compare", "Next difference" , "Previous Difference" and rest but button "Edit mode" is not active (grayed, not clickable), not know why. Both compared files are circa 250 kB size , circa 1800 lines of text, so no so large as one could assume that's the cause.

In Help file I read description of Compare:
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.


My files are far less than 2 MB....
I wanted to make edit one of compared files when watching differences from other panel but can't click "Edit mode" button
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *Stefan2 »

Where are the files located? (local, USB, server, ...)
Are they are write protected? (can you modify them outside of compare?)





 
mattin
Junior Member
Junior Member
Posts: 9
Joined: 2021-01-02, 10:53 UTC

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *mattin »

Both are on my local ssd disk, I can edit them normally when opened in Notepad++ or under F4 in Tc but not in Edit mode as above :(
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *Dalai »

The files are most likely pretty large. By default TC maps files with 1048576 bytes or more into memory, disabling the ability to edit them in the "Compare by content" window. There is a setting to change this, see TC help, section 4.b):
MaxCompareSizeInMem=1048576
Compare by content: Size limit for files which are loaded completely in memory for comparison. Larger files are mapped into memory.
I vaguely remember that the value might be the sum of both file sizes, but I'm not sure.

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
mattin
Junior Member
Junior Member
Posts: 9
Joined: 2021-01-02, 10:53 UTC

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *mattin »

files are 250 KB only, and 1048576 is circa 1 MB, so my files are 1/4 of that limit, isn't it ?
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *Dalai »

Sorry, I somehow missed that you mentioned the file size in the OP already.

Are there very long lines in these files, something like 4096 characters or more?

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
mattin
Junior Member
Junior Member
Posts: 9
Joined: 2021-01-02, 10:53 UTC

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *mattin »

unfortunately yes, there are very long lines inside, scripts in Javascropt which someone put as oneliner, over 8000 long as I see in Notepad++, so because it's script then don't know in which place I can "break" it to split to 2 lines, to not break the code. As I suppose it's cause as you suggested ?
If yes then OK, I can live with it, at least now I know TC limitation.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *Dalai »

Yes, overly long lines and file size are the two main reasons why the edit mode gets disabled.

If you can, insert line breaks to shorten the lines. Usually JS code should keep working when inserting a line break after a statement (terminated by a semicolon).

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
mattin
Junior Member
Junior Member
Posts: 9
Joined: 2021-01-02, 10:53 UTC

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *mattin »

Thank you Dalai for help, in spare time I'll test if I can break that long lines of code without messing the code. Btw I checked, these 3 looong lines are jQuery code imported into that html file. Someone put them inside instead of putting only short url to download jQuery live.
/* --- jQuery 1.6.2: http://jquery.com/ --- */
Ane below are mentioned 3 lines, but what is interesting, I checked how each of these 3 lines ends at far far right side after scrolling to end of these lines and:
1st line: .............trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.
2nd line: .............(this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])(j),d=d.concat(j
3rd line: .............:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);

So it looks like last line (3) ends with ; but 1st h=i. and 2nd concat(j end totally random, but not being dev cant be sure.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *Dalai »

It's possible that JS doesn't really care about line breaks (and much more about syntax), but since I know very very little about JS I can't really say.

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: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: "Edit mode" button inactive (greyed) in Compare by content

Post by *ghisler(Author) »

Normally there shouldn't be a problem breaking such code into multiple lines. You need to add a line break at specific locations, though ,e.g. after a ";" or before a "{" should always work.

The reason why there is a character limit is that Windows crashes with some display adapters when trying to display a text string longer than a certain limit. This limit is 32768 characters on Windows NT based systems. TC will split longer strings into multiple calls in read only mode, but this would be difficult in edit mode.

In Tc 10 and older, the limit was 16350 characters on all systems, so you may want to update if the lines are shorter than 32768 characters.
Author of Total Commander
https://www.ghisler.com
Post Reply