User forums > General (but related to Code::Blocks)

Current status of PHP files support in Code::Blocks?

<< < (2/4) > >>

dmoore:
GOD DAMN THAT WAS A HARD BUG TO FIND!

the problem is that by default scintilla uses 5 style bits, but all the required PHP styles require 7 bits. In file sdk/editorcolourset.cpp I added the single line (marked with +++)


--- Code: ---void EditorColourSet::Apply(HighlightLanguage lang, cbStyledTextCtrl* control)
{
...
        control->SetLexer(mset.m_Lexers);
+++     control->SetStyleBits(7);
...
}

--- End code ---

and used the attached lexer file. Now php enclosed in "<?php" and "?>" renders fine (I haven't tested thoroughly).

I'm pretty sure you can also use a php specific lexer file with lexer code wxSCI_LEX_PHPSCRIPT (69). We can also add styles and keywords for all of the supported html embedded scripts (Javascript/Python etc) as per the html properties file in SciTE. I'm guessing a proper fix should only change the stylebits for languages that need the extra bits (obviously html and php - not sure what else).

/sleeps



[attachment deleted by admin]

MortenMacFly:
Nice one! :D Seems to work for me, too.

--- Quote from: dmoore on May 31, 2007, 07:00:27 am ---
--- Code: ---+++     control->SetStyleBits(7);

--- End code ---
[...] I'm guessing a proper fix should only change the stylebits for languages that need the extra bits (obviously html and php - not sure what else).

--- End quote ---
Maybe GetStyleBitsNeeded() can help us out here... this should actually return the bits required for the specific lexer. Not sure if it works, though... testing... ;-)
With regards, Morten.

MortenMacFly:
Mmmmh... it seems to work with:

--- Code: --- control->SetStyleBits(control->GetStyleBitsNeeded());

--- End code ---
This seems more "generic"... dmoore: Mind giving it a try, too for more testing?

dmoore:
thanks for the update. i new there had to be an easy way to find the style bits...

does it work on your PHP lexer html file?

MortenMacFly:

--- Quote from: dmoore on May 31, 2007, 01:37:07 pm ---does it work on your PHP lexer html file?

--- End quote ---
Depends on what you mean by "work". I've attached a screenshot for PHP embedded in HTML using your enhanced html lexer file. Using a "pure" *.php file looks similar. Does that look OK? (I can't remember how it was before, unfortunately...).

[attachment deleted by admin]

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version