You are here: PSPad forum > English discussion forum > Syntax Highlighting sometimes isn't on automatically

Syntax Highlighting sometimes isn't on automatically

#1 Syntax Highlighting sometimes isn't on automatically

Posted by: halweg | Date: 2020-10-01 14:02 | IP: IP Logged

Hi,

I'm using PSPad for Autohotkey Files for years.
The syntax highlighting works good too but some files won't switch the syntax highlighter on automatically when loaded.

It's strange: I have for instance 2 different .ahk files, saying a.ahk and b.ahk. Both work with the "Autohotkey" Syntax-Highlighter . When I open a.ahk the syntax highlighting is on. When I open b.ahk the syntax highlighting must be activated manually.

When I copy the content from b.ahk to a.ahk I have to subsequently manually activate the highlighting in a.ahk too.

It seems to be related with the files content: When I delete some lines in b.ahk automatic syntax highlighting will work. But it doesn't depend on file size. The lines I delete seems nothing special.

What may be the reason for this behavior?

Greetings, Halweg

Options: Reply | Quote | Up ^


#2 Re: Syntax Highlighting sometimes isn't on automatically

Posted by: pspad | Date: 2020-10-01 14:17 | IP: IP Logged

Hello

There is a file size limit for autohighlight syntax.
The limit is maybe set too low for current computer power.

Open program settings / Direct edit button
Change value of the variable HLUpToSize e.g. to 500 000:
HlUpToSize=500000

It means files to 500 kB size will be highlighted automatically.
Please don't increase it above the about 1,2MB, it's integer value.

Options: Reply | Quote | Up ^


#3 Re: Syntax Highlighting sometimes isn't on automatically

Posted by: halweg | Date: 2020-10-02 05:49 | IP: IP Logged

Thanks for the fast response!

Despite of only 2500 lines of code I took a look at the real file size and detected that it was 3,5 MB. So this was the reason.
The size comes from endless spaces at the end of many lines. I have no idea where they came from.
And yes, I forgot to set "Clear spaces at the end of each line".

A replacement of all "\s*$" finished the mystery. Now the file has a size of 115 kB.

Best regards, Halweg

Options: Reply | Quote | Up ^


#4 Re: Syntax Highlighting sometimes isn't on automatically

Posted by: pspad | Date: 2020-10-02 07:14 | IP: IP Logged

Menu Edit / Lines manipulation / Remove redundant spaces

Options: Reply | Quote | Up ^


#5 Re: Syntax Highlighting sometimes isn't on automatically

Posted by: halweg | Date: 2020-10-02 07:42 | IP: IP Logged

Thanks, but I hope that only this one file is affected.

Options: Reply | Quote | Up ^


#6 Re: Syntax Highlighting sometimes isn't on automatically

Posted by: Andreas | Date: 2020-10-02 10:42 | IP: IP Logged

Or select the 2500 lines and then ctrl-c(copy), ctrl-a(all), ctrl-v(paste), ctrl-s(save).

Options: Reply | Quote | Up ^


#7 Re: Syntax Highlighting sometimes isn't on automatically

Posted by: halweg | Date: 2020-10-02 12:06 | IP: IP Logged

Thanks. As I said before the replacement of "\s*$" already did the job.

But I'm still wondering what could be the reason of blowing up a textfile with 3 MB of spaces.

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR