GoScintilla - 2.7 (Purebasic 4.5 onwards)
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
hello
currently Go_scintilla allows completion using the mouse or the Tab key or Return key...
how to execute the completion with the space key? (as with jaPBe)
currently Go_scintilla allows completion using the mouse or the Tab key or Return key...
how to execute the completion with the space key? (as with jaPBe)
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
I needed to convert goscintilla to a module library, but had to do some dirty trick because of the osx mandatory procedureDLL callback. Should I post it there?
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
Of course, post it here! Free wine for all...!Poshu wrote:Should I post it there?
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
So GoScintilla 2.7 converted to module (and, as said before : dirty, dirty solution to make it compatible with OSX). I only converted a single example though, sorry about that.
And now, for some help :
I can't get GoScintilla to behave : I need // to be the start of a comment, and /* */ to set a command block, I tried :
but it doesn't work, even though the first like works perfectly with ;. Is / some diabolical character or what?
Edit : seems like it doesn't like double character as a delimiter, maybe I should read the doc :oops: ?
Edit 2 : I read the doc, nothing about several character delimiter, and the source is too complicated for me. Any help?
And now, for some help :
I can't get GoScintilla to behave : I need // to be the start of a comment, and /* */ to set a command block, I tried :
Code: Select all
GoScintilla::GOSCI_AddDelimiter(*WindowData\Scintilla, "//", "", GoScintilla::#GOSCI_DELIMITTOENDOFLINE, #STYLES_COMMENTS)
GoScintilla::GOSCI_AddDelimiter(*WindowData\Scintilla, "/*", "*/", GoScintilla::#GOSCI_DELIMITBETWEEN, #STYLES_COMMENTS)
Edit : seems like it doesn't like double character as a delimiter, maybe I should read the doc :oops: ?
Edit 2 : I read the doc, nothing about several character delimiter, and the source is too complicated for me. Any help?
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
Did you look at the GoSci examples? I am pretty sure there is an example there...I have used it. Look in this folder:
GoScintilla\Demos\AdvancedDemos\BlockComments
GoScintilla\Demos\AdvancedDemos\BlockComments
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
Yup, I didn't check the exemple, should have done that, thanks.Tenaja wrote:Did you look at the GoSci examples? I am pretty sure there is an example there...I have used it. Look in this folder:
GoScintilla\Demos\AdvancedDemos\BlockComments
Still on the subject : I know GoScintilla wasn't tested on OSX, and it seems to work, but I can't fold anything, even though the folding [+] does appear.
-
- User
- Posts: 58
- Joined: Wed Feb 27, 2013 9:36 am
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
Changing *bytePointer.i to *bytePointer didn't help much, as the next error occurred
(and not only in this line).
Should it be changed to #PB_String or what?
All these lil' initial setup errors make me think I do something wrong, and the whole grand thing wouldn't work as expected.
Code: Select all
Line 1787: Constant not found: #PB_Sort_String
Should it be changed to #PB_String or what?
All these lil' initial setup errors make me think I do something wrong, and the whole grand thing wouldn't work as expected.
Coding's men's knitwork.
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
yes:staringfrog wrote:Should it be changed to #PB_String or what?
PB-History wrote:14th February 2013 : Version 5.10
- Changed: replaced #PB_Sort_<Type> with #PB_<Type> to avoid possible errors
Hygge
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
@PoShu
Marvelous idea!
Thank you for getting this started...
On a different note:
Because there is a lot of redundancy while using this module:
I changed the module to accept this:
Makes a lot of sense to me...
Almost forgot:
Had some crashes while testing this module on Windows7-64.
Found out to take out the FreeMemory line here in order to avoid the crashes:
PureBasic should release the memory by his own, should it not?
Marvelous idea!
Thank you for getting this started...
Same on Linux, folding doesn't work.Poshu wrote:Still on the subject : I know GoScintilla wasn't tested on OSX, and it seems to work, but I can't fold anything, even though the folding [+] does appear.
On a different note:
Because there is a lot of redundancy while using this module:
Code: Select all
GoScintilla::GOSCI_Create(1, 10, 10, 580, 280, 0, GoScintilla::#GOSCI_AUTOSIZELINENUMBERSMARGIN)
Code: Select all
GoSci::Create(1, 10, 50, 580, 280, 0, GoSci::#AUTOSIZELINENUMBERSMARGIN)
Almost forgot:
Had some crashes while testing this module on Windows7-64.
Found out to take out the FreeMemory line here in order to avoid the crashes:
Code: Select all
Procedure Free(id)
Protected *this._GoScintilla
If IsGadget(id) And GadgetType(id) = #PB_GadgetType_Scintilla
*this = GetGadgetData(id)
If *this
ClearStructure(*this, _GoScintilla)
; activating FreeMemory will sometimes cause a crash on Windows7-64
;FreeMemory(*this)
EndIf
FreeGadget(id)
EndIf
EndProcedure
I am to provide the public with beneficial shocks.
Alfred Hitshock
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
Where can I download the latest version of this library? The site does not work
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
hi ,
I'm stuck with Goscintilla
I am defining a color for the Api with the function:
but it seems that this does not work you have an idea ??
the aim is to color all text between the beginning of the line (or word) and character "_"
Beep_(440.100)
an idea ??
I'm stuck with Goscintilla
I am defining a color for the Api with the function:
Code: Select all
GOSCI_AddDelimiter(onglet, "", "_", #GOSCI_DELIMITBETWEEN , #styles_Api)
the aim is to color all text between the beginning of the line (or word) and character "_"
Beep_(440.100)
an idea ??
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
Del
Last edited by Chaosmal on Sun Apr 16, 2017 3:19 pm, edited 1 time in total.
Re: GoScintilla 2.7 (Purebasic 4.5 onwards)
Hi
I'm new to PureBasic and I'm stuck with Goscintilla
1: I can not assign a delimiter " (Chr(34)), This leads to other problems
2: Unable to collapse the lines ;! @Install @! UTF-8! and ;!@InstallEnd
3: It does not work properly to highlight words of the form( %%^S %%S %%T %%^T), I'm not strong in regular expressions.
4 :plus the rest, just the head is all around!
Please help fix my clumsy code.
I apologize for the translator.
I'm new to PureBasic and I'm stuck with Goscintilla
1: I can not assign a delimiter " (Chr(34)), This leads to other problems
2: Unable to collapse the lines ;! @Install @! UTF-8! and ;!@InstallEnd
3: It does not work properly to highlight words of the form( %%^S %%S %%T %%^T), I'm not strong in regular expressions.
4 :plus the rest, just the head is all around!
Please help fix my clumsy code.
Code: Select all
;/////////////////////////////////////////////////////////////////////////////////
;***Go-Scintilla 2***
;/////////////////////////////////////////////////////////////////////////////////
XIncludeFile "GoScintilla.pbi"
Procedure GOSCI_SetLineHighlightColor(id, color)
#GOSCI_HIGHLIGHTERMARKERNUM=#GOSCI_BOOKMARKMARKERNUM+1
ScintillaSendMessage(1, #SCI_MARKERSETBACK, #GOSCI_HIGHLIGHTERMARKERNUM, color)
ScintillaSendMessage(1, #SCI_MARKERDEFINE, #GOSCI_HIGHLIGHTERMARKERNUM, #SC_MARK_BACKGROUND)
EndProcedure
Procedure GOSCI_SetLineHighlighted(id, lineIndex, flag=#True)
If IsGadget(id) And GadgetType(id)=#PB_GadgetType_Scintilla
If flag
ScintillaSendMessage(id, #SCI_MARKERADD, lineIndex, #GOSCI_HIGHLIGHTERMARKERNUM)
Else
ScintillaSendMessage(id, #SCI_MARKERDELETE, lineIndex, #GOSCI_HIGHLIGHTERMARKERNUM)
EndIf
EndIf
EndProcedure
Declare.i MyLineStyler(id, *utf8Buffer.ASCII, numUtf8Bytes, currentLine, startLine, originalEndLine)
;Initialise the Scintilla library for Windows.
CompilerIf #PB_Compiler_OS=#PB_OS_Windows
InitScintilla()
CompilerEndIf
If OpenWindow(0, 100, 200, 700, 600, "Test!", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
;Required for the tab key to function correctly when the Scintilla control has the focus.
RemoveKeyboardShortcut(0, #PB_Shortcut_Tab)
RemoveKeyboardShortcut(0, #PB_Shortcut_Tab | #PB_Shortcut_Shift)
;Create our Scintilla control. Note that we do not specify a callback; this is optional for GoSctintilla.
GOSCI_Create(1, 10, 10, 680, 580, 0, #GOSCI_AUTOSIZELINENUMBERSMARGIN)
;Set the padding added to the width of the line-number margin.
GOSCI_SetAttribute(1, #GOSCI_LINENUMBERAUTOSIZEPADDING, 10)
;Set folding symbols margin width.
GOSCI_SetMarginWidth(1, #GOSCI_MARGINFOLDINGSYMBOLS, 12)
;Set font.
GOSCI_SetFont(1, "Courier New", 12)
;Set tabs. Here we use a 'hard' tab in which a tab character is physically inserted. Set the 3rd (optional) parameter to 1 to use soft-tabs.
GOSCI_SetTabs(1, 3)
;Set colors of text area
GOSCI_SetColor(1, #GOSCI_FORECOLOR, $FFFFFF)
GOSCI_SetColor(1, #GOSCI_BACKCOLOR, $9f5000)
;Set colors of caret (caret color and the back color of the line containing the caret)
GOSCI_SetColor(1, #GOSCI_CARETFORECOLOR, $FFFFFF)
GOSCI_SetColor(1, #GOSCI_CARETLINEBACKCOLOR, $b35900)
;Set colors of selection
GOSCI_SetColor(1, #GOSCI_SELECTIONBACKCOLOR, $8080ff)
GOSCI_SetColor(1, #GOSCI_SELECTIONFORECOLOR, $000000)
;Set colors of line margin
GOSCI_SetColor(1, #GOSCI_LINENUMBERFORECOLOR, $c0c0c0)
GOSCI_SetColor(1, #GOSCI_LINENUMBERBACKCOLOR, $804000)
;Set colors of fold margin
GOSCI_SetColor(1, #GOSCI_FOLDMARGINHIBACKCOLOR, $804000)
GOSCI_SetColor(1, #GOSCI_FOLDMARGINLOBACKCOLOR, $804000)
;Set colors of fold markers
GOSCI_SetColor(1, #GOSCI_FOLDMARKERSFORECOLOR, $804000)
GOSCI_SetColor(1, #GOSCI_FOLDMARKERSBACKCOLOR, $c0c0c0)
;Highlighters
;==========
;Set colors of line highlighter.
GOSCI_SetLineHighlightColor(1, $aa5500)
;Set styles for our syntax highlighting.
;=======================================
;First define some constants to identify our various styles.
;You can name these as we wish.
Enumeration
#STYLES_COMMANDS=1
#STYLES_VARIABLES
#STYLES_COMMENTS
#STYLES_LITERALSTRINGS
#STYLES_NUMBERS
#STYLES_CONSTANTS
#STYLES_FUNCTIONS
#STYLES_SEPARATORS
#STYLES_OPERATORS
#STYLES_TYPES
EndEnumeration
;Set individual styles for commands.
GOSCI_SetStyleFont(1, #STYLES_COMMANDS, "", -1, #PB_Font_Bold)
GOSCI_SetStyleColors(1, #STYLES_COMMANDS, $ffff80)
;Set individual styles for comments.
GOSCI_SetStyleColors(1, #STYLES_COMMENTS, $00ffff)
;Set individual styles for literal strings.
GOSCI_SetStyleColors(1, #STYLES_VARIABLES, $00ff00)
;Set individual styles for numbers.
GOSCI_SetStyleColors(1, #STYLES_NUMBERS, $FF00FF)
;Set individual styles for constants.
GOSCI_SetStyleColors(1, #STYLES_CONSTANTS, $66b3ff) ;We have omitted the optional back color.
;Set individual styles for functions.
GOSCI_SetStyleColors(1, #STYLES_FUNCTIONS, $fdb382) ;We have omitted the optional back color.
;Set individual styles for separators.
GOSCI_SetStyleColors(1, #STYLES_SEPARATORS, $0032FF) ;We have omitted the optional back color.
;Set individual styles for operators.
GOSCI_SetStyleColors(1, #STYLES_OPERATORS, $8080ff) ;We have omitted the optional back color.
;Set individual styles for types.
GOSCI_SetStyleColors(1, #STYLES_TYPES, $ffccff) ;We have omitted the optional back color.
;Set delimiters and keywords for our syntax highlighting.
;========================================================
;Delimiters.
;First set up a ; symbol to denote a comment.
GOSCI_AddDelimiter(1, ";", "", #GOSCI_DELIMITTOENDOFLINE, #STYLES_COMMENTS)
;Now set up quotes to denote literal strings.
GOSCI_AddDelimiter(1, "%", "%", #GOSCI_DELIMITBETWEEN, #STYLES_VARIABLES)
;Now set up a # symbol to denote a constant.
GOSCI_AddDelimiter(1, ":",Chr(34),#GOSCI_RIGHTDELIMITWITHOUTWHITESPACE , #STYLES_CONSTANTS)
GOSCI_AddKeywords(1, ";!@Install@!UTF-8!", #STYLES_COMMENTS, #GOSCI_OPENFOLDKEYWORD | #GOSCI_ADDTOCODECOMPLETION)
GOSCI_AddKeywords(1, ";!@InstallEnd", #STYLES_COMMENTS, #GOSCI_CLOSEFOLDKEYWORD | #GOSCI_ADDTOCODECOMPLETION)
;Basic command keywords.
GOSCI_AddKeywords(1, "Title Directory Shortcut Shortcut1 Flags SetEnvironment", #STYLES_COMMANDS)
GOSCI_AddKeywords(1,"Name FullName Vers ",#STYLES_CONSTANTS,#GOSCI_ADDTOCODECOMPLETION)
;Add separator keywords
GOSCI_AddKeywords(1, "/ \ { } = Chr(34) , .", #STYLES_SEPARATORS)
;Add operator keywords
GOSCI_AddKeywords(1, " + - * & | < > -", #STYLES_OPERATORS)
;Additional lexer options.
;=========================
GOSCI_SetLexerOption(1, #GOSCI_LEXEROPTION_SEPARATORSYMBOLS, @"/\={}Chr(34),-+")
GOSCI_SetLexerOption(1, #GOSCI_LEXEROPTION_NUMBERSSTYLEINDEX, #STYLES_NUMBERS)
;===========================================
GOSCI_SetLineStylingFunction(1, @MyLineStyler())
;======================
text$ = ";!@Install@!UTF-8!"+ #CRLF$
text$ + ";{ GoScintilla." + #CRLF$ + #CRLF$ + #CRLF$
text$ + ";} By Stephen Rodriguez." + #CRLF$ + #CRLF$
text$ + "SetEnvironment=" + Chr(34) + "Name=Programs" + Chr(34) + #CRLF$
text$ + "SetEnvironment=" + Chr(34) + "Vers=0.0.0." + Chr(34) + #CRLF$
text$ + "Title=" + Chr(34) + "Bla-Bla-Bla %Name% %Vers%" + Chr(34) + #CRLF$
text$ + "Flags=" + Chr(34) + "2+4+8+16+32+2048+4096" + Chr(34) + #CRLF$
text$ + "Directory=" + Chr(34) + "x86:fm20:\"+ Chr(34) + "%StartEXE%\" + Chr(34) + #CRLF$
text$ + "Shortcut=" + Chr(34) + "Du,{%%T\\Name.exe},{},{},{},{%FullName%}" + Chr(34) + #CRLF$
text$ + "Shortcut1=" + Chr(34) + "Pu,{%%S\\Name2.exe},{},{},{},{%FullName%},{1}" + Chr(34) + #CRLF$ + #CRLF$
text$ + ";!@InstallEnd" + #CRLF$
GOSCI_SetText(1, text$)
Repeat
eventID=WaitWindowEvent()
Select eventID
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until eventID=#PB_Event_CloseWindow
GOSCI_Free(1)
EndIf
;/////////////////////////////////////////////////////////////////////////////////
;The following is our user-defined line-styling function, called whenever GoScintilla is called upon to style lines.
Procedure.i MyLineStyler(id, *utf8Buffer.ASCII, numUtf8Bytes, currentLine, startLine, originalEndLine)
Protected result=#GOSCI_STYLELINESASREQUIRED, numBytesStyled, symbolJustStyled$, *ptrAscii.ASCII
Static regexVAR
If Not regexVAR
;{ Init search patterns
Enumeration
#Highlight_Remove=-1
#Highlight_None=0
#Highlight_Visible=1
#Highlight_End=2
EndEnumeration
regexVAR=CreateRegularExpression(#PB_Any, "[%][%][\S]") ; %%S %%T %%^S %%^T
;}
EndIf
lineHighlighting=GOSCI_GetLineData(id, currentLine-1)
While numUtf8Bytes
Dim foundSymbol$(0)
Select *utf8Buffer\a
Case ';'
;{ search fold markers to update fold levels
textToExamine$=LCase(PeekS(*utf8Buffer, numUtf8Bytes, #PB_UTF8))
Select Left(textToExamine$, 2)
Case ";{"
GOSCI_IncFoldLevel(id)
Case ";}"
GOSCI_DecFoldLevel(id)
EndSelect
; Select Left(textToExamine$, 2)
; Case ";!"
; GOSCI_IncFoldLevel(id)
; Case ";!"
; GOSCI_DecFoldLevel(id)
; EndSelect
Case '%'
textToExamine$=LCase(PeekS(*utf8Buffer, numUtf8Bytes, #PB_UTF8))
If ExtractRegularExpression(regexVAR, textToExamine$, foundSymbol$()) Or ExtractRegularExpression(regexBIN, textToExamine$, foundSymbol$())
numBytesStyled=Len(foundSymbol$(0))
ScintillaSendMessage(id, #SCI_SETSTYLING, numBytesStyled, #STYLES_VARIABLES)
numUtf8Bytes-numBytesStyled
*utf8Buffer+numBytesStyled
Continue
EndIf
EndSelect
numBytesStyled=GOSCI_StyleNextSymbol(id, *utf8Buffer, numUtf8Bytes)
symbolJustStyled$=LCase(PeekS(*utf8Buffer, numBytesStyled, #PB_UTF8))
If symbolJustStyled$=";!@Install@!UTF-8!"
lineHighlighting=#Highlight_Visible
ElseIf symbolJustStyled$=";!@InstallEnd"
If lineHighlighting=#Highlight_Visible
lineHighlighting=#Highlight_End
Else
lineHighlighting=#Highlight_Remove
EndIf
EndIf
numUtf8Bytes-numBytesStyled
*utf8Buffer+numBytesStyled
Wend
; If GOSCI_GetLineData(id, currentLine)<>lineHighlighting
; Select lineHighlighting
; Case #Highlight_Visible
; GOSCI_SetLineData(id, currentLine, #Highlight_Visible)
; GOSCI_SetLineHighlighted(id,currentLine,1)
; Case #Highlight_End
; GOSCI_SetLineData(id, currentLine, #Highlight_None)
; GOSCI_SetLineHighlighted(id, currentLine, 1)
; Case #Highlight_None, #Highlight_Remove
; GOSCI_SetLineData(id, currentLine, #Highlight_None)
; GOSCI_SetLineHighlighted(id, currentLine, 0)
; EndSelect
; result=#GOSCI_STYLENEXTLINEREGARDLESS
; EndIf
ProcedureReturn result
EndProcedure
;/////////////////////////////////////////////////////////////////////////////////
Re: GoScintilla - 2.7 (Purebasic 4.5 onwards)
Scilexer has internal lexing ability. Maybe someone can explain, how it can be written? I made a lexer in GoScintilla, but it is extremly slow. After loading a sourcer code it takes minutes until the highlightning and folding is finished, and sometimes new entered code is not highlighted after all, unlass I update it manually (delerting a non existent command from command list).
My PC
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10