Scintilla: auto-indent: how to?
Scintilla: auto-indent: how to?
Hello:
I'm searching for auto-indent feature for Scintilla, with no luck.
did someone developed that and like to share?
Thanks in advance
I'm searching for auto-indent feature for Scintilla, with no luck.
did someone developed that and like to share?
Thanks in advance
PureBasic: Surprisingly simple, diabolically powerful
Re: Scintilla: auto-indent: how to?
My method which is unlikely to be the "correct" way is:
I intercept the CR key and do a number if things when the line ends.
Because the CR was intercepted, the first thing is to insert the end-of-line character(s)
Then I copy the line indentation from the last line to the new line.
Look in the scintilla help for #SCI_GETLINEINDENTATION and #SCI_SETLINEINDENTATION.
You might want to work out if the new line needs a different indentation based on the text of the previous line.
It works for me...
I intercept the CR key and do a number if things when the line ends.
Because the CR was intercepted, the first thing is to insert the end-of-line character(s)
Then I copy the line indentation from the last line to the new line.
Look in the scintilla help for #SCI_GETLINEINDENTATION and #SCI_SETLINEINDENTATION.
You might want to work out if the new line needs a different indentation based on the text of the previous line.
It works for me...
Re: Scintilla: auto-indent: how to?
Thank you, I'll try.
Meanwhile, I still searching for a readymade solution
Meanwhile, I still searching for a readymade solution
PureBasic: Surprisingly simple, diabolically powerful
Re: Scintilla: auto-indent: how to?
Perhaps you can take a look at the PB IDE source code, which uses Scintilla:
https://www.purebasic.fr/english/viewtopic.php?t=74151
(Procedure UpdateIndent and Procedure AutoIndent)
https://www.purebasic.fr/english/viewtopic.php?t=74151
(Procedure UpdateIndent and Procedure AutoIndent)
Re: Scintilla: auto-indent: how to?
Look for GoScintilla on the forum. It's a full featured library that takes care of almost all of the regularly used features of an IDE, including this. At the least, you can copy the procs needed.morosh wrote: Sun Jul 28, 2024 7:31 am Hello:
I'm searching for auto-indent feature for Scintilla, with no luck.
did someone developed that and like to share?
Thanks in advance
Re: Scintilla: auto-indent: how to?
I was considering migrating from rich editor to scintilla for easier syntax highlighting and indenting.
I started to browse the IDE code but globals are in another area and it is slightly difficult to follow.
Does GoScintilla support syntax highlighting?
I read Lexilla is now a separate lib.
Does anyone have code snippet calling the lexer directly?
Is it less or more work to recreate the lexer commands for a single language?
I started to browse the IDE code but globals are in another area and it is slightly difficult to follow.
Does GoScintilla support syntax highlighting?
I read Lexilla is now a separate lib.
Does anyone have code snippet calling the lexer directly?
Is it less or more work to recreate the lexer commands for a single language?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Scintilla: auto-indent: how to?
Thank you all!!!
yes GoScintilla is really excellent, finally my callback looks like that (if anyone is also looking for, like me):
yes GoScintilla is really excellent, finally my callback looks like that (if anyone is also looking for, like me):
Code: Select all
Procedure ScintillaCallBack(Gadget, *scinotify.SCNotification)
Protected nPos, startLine, level
Select *scinotify\nmhdr\code
Case #SCN_CHARADDED
If *scinotify\ch=10
nPos = ScintillaSendMessage(Gadget, #SCI_GETCURRENTPOS)
startLine = ScintillaSendMessage(Gadget, #SCI_LINEFROMPOSITION, nPos)-1
level = ScintillaSendMessage(Gadget, #SCI_GETLINEINDENTATION, startLine)
If level > 0
startLine+1
ScintillaSendMessage(Gadget, #SCI_SETLINEINDENTATION, startLine, level)
nPos = ScintillaSendMessage(Gadget, #SCI_GETLINEINDENTPOSITION, startLine)
ScintillaSendMessage(Gadget, #SCI_GOTOPOS, nPos)
EndIf
EndIf
Case #SCN_STYLENEEDED
Highlight(Gadget, *scinotify\position)
EndSelect
EndProcedure
PureBasic: Surprisingly simple, diabolically powerful
Re: Scintilla: auto-indent: how to?
gosci is a full featured customizable lexer that supports almost everything.Does GoScintilla support syntax highlighting?
Re: Scintilla: auto-indent: how to?
Where is the latest gosci lib/module?
I found a module from 2019.
I found a module from 2019.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Scintilla: auto-indent: how to?
That module is probably the latest. I have not been using it lately, so I have not updated it myself. With srod being inactive since 2020, he has not been updating it. However, in 2017, he posted:skywalk wrote: Fri Aug 02, 2024 4:47 pm Where is the latest gosci lib/module?
I found a module from 2019.
Any updates that are required should be minimal. It is an excellent, thorough, and consistent library, and would be worth your time if you want to do anything more than one or two features. The examples that he provided were also quite helpful, and well rounded.current version of GoScintilla (2.7) seems to work fine with PB 5.51 x86
Re: Scintilla: auto-indent: how to?
I found it here: v301
Yes, it is an excellent library. I was writing too much code already available in these fine libs.
Yes, it is an excellent library. I was writing too much code already available in these fine libs.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Scintilla: auto-indent: how to?
GoScintilla works well with PB6.11 x64. Windows and Linux.
There are a few places where .l needs changing to .i
I also had to change the size allocated to some string buffers at some stage. My notes are not very informative.
My main project uses a mixture of goScintilla and direct ScintillaSendMessage calls.
There are a few places where .l needs changing to .i
I also had to change the size allocated to some string buffers at some stage. My notes are not very informative.
My main project uses a mixture of goScintilla and direct ScintillaSendMessage calls.
Re: Scintilla: auto-indent: how to?
Dang it!
I'm crashing the calltip demo's when compiling threadsafe.
Without creating a thread!
Meaning, I'm just running the example code with/without threadsafe.
Just hitting backspace or enter?
And the lib does not support UTF8 characters?
I might have to go back and rewrite just what I need.
I'm crashing the calltip demo's when compiling threadsafe.
Without creating a thread!
Meaning, I'm just running the example code with/without threadsafe.
Just hitting backspace or enter?
And the lib does not support UTF8 characters?
I might have to go back and rewrite just what I need.

The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum