I made this slight change to AddKeywords to speed it up when changing styling. It could probably be applied to all procs that call RestyleLines. It is backwards compatible.
(See the argument restyle.i = #True and the test for it when calling RestyleLinesXXX).
;/////////////////////////////////////////////////////////////////////////////////
;The following function records a list of keywords to use the style specified. The list of words are to be separated by space characters.
;Note that only Ascii characters must be used within each keyword.
;Duplicates are simply replaced.
;Set keywordFlags to one (or more) of the keyword flags #GOSCI_OPENFOLDKEYWORD, #GOSCI_CLOSEFOLDKEYWORD or GOSCI_ADDTOCODECOMPLETION ... etc.
Procedure GOSCI_AddKeywords(id, keyWords$, styleIndex=#STYLE_DEFAULT, keywordflags=0, blnSortKeywords=#False, restyle.i = #True)
Protected *this._GoScintilla, t1
If GOSCI_AddKeywordsXXX(id, keyWords$, styleIndex, keywordFlags)
*this = GetGadgetData(id)
If *this
If blnSortKeywords
If *this\flags & #GOSCI_KEYWORDSCASESENSITIVE = 0
t1 = #PB_Sort_NoCase
EndIf
SortStructuredList(*this\Keywords(), #PB_Sort_Ascending|t1, OffsetOf(GoScintillaKeyword\keyWord$), #PB_Sort_String)
EndIf
EndIf
If restyle = #True
GOSCI_RestyleLinesXXX(ID, 0, -1)
EndIf
EndIf
EndProcedure
;/////////////////////////////////////////////////////////////////////////////////
Ah, I would guess that JaPBe uses a marker for this (you can use markers to change the back color of individual lines). It is quite easy to do, but you will need to dip into the Scintilla API to define the marker and then add the marker to and remove the marker from lines as and when required.
I may look like a mule, but I'm not a complete ass.
GoScintilla 2.5 adds an optional parameter (restyle = #True) to certain functions which can be used to stop GoScintilla redrawing a control's contents whilst we set/reset individual style parameters. Useful if you are altering styles after loading text into a control, otherwise every single alteration will result in the entire document being restyled which can result in some serious delays if there is a lot of text loaded into the control.
You can of course use the GOSCI_SetState() function to restyle the entire document when you are done making alterations.
No existing code will be broken by these changes.
The help manual has been updated.
Thanks to Tenaja.
Please see the nxSoftware site for the download.
I may look like a mule, but I'm not a complete ass.
I am using GoScintilla for some custom lexering ( ) and I thought it would be nice to be able to add the ability to also edit "other" files, since Scintilla has so many lexers built in.
I have successfully gotten the other lexers to work on their own. I pasted that code into my large editor file, and the text just goes plain, with no colors at all. I am wondering what is missing? Do I need to remove the Gosci callback?
Has anybody gotten Scintilla to work, switching back/forth from Gosci to Scintilla's lexers?
Tenaja wrote:I am using GoScintilla for some custom lexering ( ) and I thought it would be nice to be able to add the ability to also edit "other" files, since Scintilla has so many lexers built in.
I have successfully gotten the other lexers to work on their own. I pasted that code into my large editor file, and the text just goes plain, with no colors at all. I am wondering what is missing? Do I need to remove the Gosci callback?
Has anybody gotten Scintilla to work, switching back/forth from Gosci to Scintilla's lexers?
I have it isolated to the SetLexer command failing. In the simple sample, I use this, and see the debug values change as expected (0, then 3):
However, in the program that uses Gosci, both of those debug statements result in 0. Why would the Scintilla gadget fail to assign the lexer using the same code, after using Gosci?