Hello,
Is there a way to automatically disable highlighting on a file if this file is bigger than a specific size?
For example, I would like to open a big SQL file but without highlighting (for better performance at opening and parsing file)
I have had a look in "Options" and "Highlighting and margin" but without success.
Thanks in advance for your answer and have a nice day.
Disable highlighting on a file size limit
Re: Disable highlighting on a file size limit
I don't know if you still need a hand here, but here's my solution: set this particular file format to simple text and run script posted below on file open:
If any file has the extension you want and is bigger than the threshold you set, appropriate highlighter will be switched on; otherwise, it will be displayed without any.
Code: Select all
let threshold = 1000000;
let myExt = "xml";
let myHighlighter = "xml";
let len = length(Document.Text());
let filename = Document.FileName();
let ext = Copy(filename, length(filename) - 2, 3);
if ((ext == myExt) && (len < threshold)) {
MainApp.SetHighlighter(myHighlighter);
}
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
Re: Disable highlighting on a file size limit
Hi pjj,
Thanks a lot for your answer.
I haven't thought about using a script when opening file and I have never used them before but I will have a look at these nice functionality.
RJ TextEd is so powerful
Thanks a lot for your answer.
I haven't thought about using a script when opening file and I have never used them before but I will have a look at these nice functionality.
RJ TextEd is so powerful

Re: Disable highlighting on a file size limit
It truly is!
Please let me know if my script has worked for you. -- Btw it could be enhanced to accommodate files of all types (i.e. extensions), however I don't think it is the best idea to switch off native support for all highlighters and then switch them on via a script.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus