Page 5 of 7

Re: PBEdit - a Canvas-based Texteditor

Posted: Fri Nov 12, 2021 7:17 pm
by ShadowStorm
In a few simple words:

Incredible, I am amazed by this titanic work, you are a good one too :D

Thanks a lot !

Re: PBEdit - a Canvas-based Texteditor

Posted: Sat Nov 13, 2021 3:58 am
by Neil
Hi Mr L,

Windows 10 Home 64 bit.

Thanks,

Neil

Re: PBEdit - a Canvas-based Texteditor

Posted: Sat Nov 13, 2021 11:21 am
by ChrisR
Neil wrote: Thu Nov 11, 2021 11:24 am So I have loaded PureBasic6 compiler

Now I get this error message
Neil, I don't reproduce this Polink error either.
It is successfully compiled here with PB_6.00_Alpha5_x64 compiler C and ASM, and also of course with PB_5.73_LTS_x64 on Windows 10 Home 64 bit.
With the C compiler, TextEditor is 72 kb smaller.
it is undoubtedly on your side with your machine or config, however, no idea :!:

@Mr.L
When using PBEdit_SetGadgetText(), would it be possible to have a specific character that could be inserted, at the beginning of a line, before Enumerations or Procedures to tell PBEdit to display them folded or not and maybe a new function ex: PBEdit_enableFoldingAll(ID) would be interesting ?

Re: PBEdit - a Canvas-based Texteditor

Posted: Sat Nov 13, 2021 8:28 pm
by Mr.L
Here is the new version (1.0.10) with the following changes

fixed: first lineNr was zero after initialization
fixed: bug in calculation of vertical scrollbar position
changed: flags in the TE_STRUCT are now a combination of "binary bit flags"
changed: renamed TE_CURSORSTATE\state to TE_CURSORSTATE\dragDropMode
added: PBEdit_SetFlag(ID, Flag, Value): set or clear the specified flag (eg. PBEdit_SetFlag(EditorID, #TE_EnableReadOnly, 1))
added: PBEdit_GetFlag(ID, Flag): get the specified flag
added: PBEdit_SetGadgetFont(ID, FontName$, FontHeight = 0, FontStyle = 0)
added: TE_STRUCT\foldChar (default: 1): a special character that indicates the foldstate of a newly inserted textline
added: horizontal autoscroll

a folded textline can be inserted like that:

Code: Select all

PBEdit_SetGadgetText(editor, Chr(1) + "Procedure Test()" + Chr(10) + "    ; example of a foleded textblock" + Chr(10) + "EndProcedure")

Re: PBEdit - a Canvas-based Texteditor

Posted: Sun Nov 14, 2021 12:29 pm
by ChrisR
Wow, awesome :)
The Vertical scrollbar, auto-scroll works well now.
And the layout is great with the separation line below procedures, macros or the highlighting keywords, If Else EndIf, Select Case EndSelect,... very useful for reading.

All is there, the only thing that is missing, for now, is the quick help function in the status bar.
Otherwise, I noted few small details:
When selecting, maybe highlight identical words only if there are more than 2 or 3 chars selected. The display is a bit weird when only one character is selected.
When folding or unfolding, it would be good to be repositioned on the folding line, the one with the icon instead of the current line, it seems to me.
The Lines breaks are lost when copying and pasting a Alt selection.

Re: PBEdit - a Canvas-based Texteditor

Posted: Wed Nov 17, 2021 12:13 am
by StarBootics
@Mr.L

About the bug I have described about not able to add lines. Apparently the Numeric Pad return key is not detected at all.

Another problem I don't know what I did wrong but while I'm tapping text it appeared backwards.

I mean instead of seeing ; This is a
The text appeared ; a si sihT

Final question do you have the GLSL settings and style files available so I will not have to define them from scratch. I would like to use your Editor Gadget to create a small program edit a GLSL Vertex Shader and Fragment Shader side by side in the same window.

Best regards
StarBootics

Re: PBEdit - a Canvas-based Texteditor

Posted: Wed Nov 17, 2021 7:49 am
by Mr.L
Hi StarBootics,
here is the GLSL style: PBEdit_GLSL.zip
(need to be extracted first, of course)

The bugs you described seem very strange to me. On my computer both return keys have the same value (13).
Can you please test with the following code, what value the "normal" return key and the one on the numeric pad have?

Code: Select all

OpenWindow(0, 0, 0, 500, 300, "Test")
CanvasGadget(0, 5, 5, 490, 100, #PB_Canvas_Keyboard|#PB_Canvas_Border)
EditorGadget(1, 5, 115, 490, 180, #PB_Editor_ReadOnly)
SetActiveGadget(0)

Repeat
	Select WaitWindowEvent()
		Case #PB_Event_CloseWindow
			End
		Case #PB_Event_Gadget
			time.s = "[" + RSet(Str(ElapsedMilliseconds()),8,"0") + "]"
			If EventType() = #PB_EventType_Input
				AddGadgetItem(1, 0, time + " #PB_EventType_Input: " + Str(GetGadgetAttribute(0, #PB_Canvas_Input)))
			ElseIf EventType() = #PB_EventType_KeyDown
				AddGadgetItem(1, 0, time + " #PB_EventType_KeyDown: " + Str(GetGadgetAttribute(0, #PB_Canvas_Key)))
			ElseIf EventType() = #PB_EventType_KeyUp
				AddGadgetItem(1, 0, time + " #PB_EventType_KeyUp: " + Str(GetGadgetAttribute(0, #PB_Canvas_Key)))
			EndIf
	EndSelect
ForEver

Re: PBEdit - a Canvas-based Texteditor

Posted: Wed Nov 17, 2021 3:08 pm
by StarBootics
Hello Mr.L

The "Normal Return" key and the "NumPad Return" key have different values.

Code: Select all

[00004861] #PB_EventType_KeyDown: 65293 <- Normal Return
[00004919] #PB_EventType_KeyUp: 65293

[00006620] #PB_EventType_KeyDown: 65421 <- NumPad  Return
[00006683] #PB_EventType_KeyUp: 65421
Thanks for the GLSL zip files.

Best regards
StarBootics

Re: PBEdit - a Canvas-based Texteditor

Posted: Thu Apr 21, 2022 5:42 pm
by Mr.L
Hi there! I have uploaded a new Version (v1.11).
Download

Here is the changelog:

v1.11
fixed: unintended scrolling after a textblock is folded/unfolded
fixed: folded textblock not unfolded, when text is edited
fixed: numpad return key not responding in linux
fixed: typo "laguage" renamed to "language"
fixed: autocomplete scrollbar not working
changed: the version number now has only two parts
changed: CanvasGadget with flag "#PB_Canvas_Container". The ScrollBars now are added to the views CanvasGadget
changed: added a ContainerGadget as parent for all views
changed: added Procedure PBEdit_Container(ID) to get the ID of the ContainerGadget
changed: removed x,y,width,height from TE_STRUCT since these values can be obtained from the ContainerGadget
changed: #TE_SyntaxCheck to #TE_SyntaxHighlight
changed: #TE_Flag_... to #TE_Syntax_... and #TE_Parser_...
changed: TE_COLORSCHEME/defaultTextColor to TE_COLORSCHEME/defaultText
changed: TE_COLORSCHEME/selectedTextColor to TE_COLORSCHEME/selectedText
changed: the blinking of the cursor is now controlled via thread (Draw_CursorThread) - enable "Create threadsafe executable" in the compiler options!
if the value "cursorBlinkDelay" in the settings file is "0" the cursor is not blinking at all
changed: reduced unnecessary redrawing of unmodified textlines (less CPU usage when idle)
changed: renamed procedure Event_Resize to Editor_Resize
changed: improved speed of dictionary update
changed: improved syntax highlighting
added: PostEvent #TE_Event_Redraw with #TE_EventType_RedrawAll or #TE_EventType_RedrawChangedLines
added: Structure TE_REPEATEDSELECTION
added: TE_REPEATEDSELECTION\minCharacterCount: number of consecutive characters that have to be selected to highlight repeated selections
added: flag #TE_RepeatedSelection_WholeWord: highlight the whole word if Nr. of selected characters >= TE_REPEATEDSELECTION\minCharacterCount
added: flag #TE_EnableHorizontalFoldLines: if true, display a horizontal line over and under a foldable textblock
added: flag #TE_EnableSelection: enable/disable selecting of text
added: flag #TE_EnableAlwaysShowSelection: enable/disable display selection if not active gadget
added: flag #TE_EnableAutoClosingKeyword: enable/disable insertion of closing keyword after Tab-Key is pressed twice

Re: PBEdit - a Canvas-based Texteditor

Posted: Thu Apr 21, 2022 6:22 pm
by pjsmith67
This works great on my Mac Studio but it is still really slow and CPU intensive on my Macbook Pro 2018 running Catalina. Don't know if it is because my Studio is really fast or if its something to do with Catalina.

Great work though!

Phil

Re: PBEdit - a Canvas-based Texteditor

Posted: Thu Apr 21, 2022 6:57 pm
by Mr.L
Hi, pjsmith67! Great to hear, that its running on your Mac Studio. I really have no clue what's the problem on your Macbook.
I have a Windows Laptop with an i5 core and It's running smoothly with around 1.5% CPU usage in idle state.
Even on a reaaally old Asus Eee PC with Windows 7 threre are no speed issues. :wink:

Re: PBEdit - a Canvas-based Texteditor

Posted: Thu Apr 21, 2022 7:41 pm
by pjsmith67
Ok, guess I will try upgrading to Monterey on my laptop and see if that works. Been meaning to do that anyway. :D

Phil

Re: PBEdit - a Canvas-based Texteditor

Posted: Thu Apr 21, 2022 11:25 pm
by pjsmith67
Upgraded to Monterey but , unfortunately, it still has performance issues. Also seeing a refresh problem on both my Macs... if you press the enter key it deletes the line the cursor is on. If you scroll up and back down again, the lines are back.

Phil

Re: PBEdit - a Canvas-based Texteditor

Posted: Wed May 11, 2022 7:46 am
by Danilo
The editor crashes very often when using the right-click menu item "Unsplit View".

When I comment out the following 2 lines inside the procedure View_Unsplit, it does not crash anymore:

Code: Select all

 			View_Delete(*te, *parent\child[0])
            View_Delete(*te, *parent\child[1])

Maybe it creates a memory leak, but it doesn't crash anymore.

Re: PBEdit - a Canvas-based Texteditor

Posted: Wed May 11, 2022 12:20 pm
by Mr.L
Danilo wrote: Wed May 11, 2022 7:46 am The editor crashes very often when using the right-click menu item "Unsplit View".
Hi, Danilo, thanks for testing!
I have a few questions.
What PB-Version are you using?
Have you set "Threadsafe" on?
What happens if you compile in debug mode?

The Procedure "View_Delete" frees the used memory and gadgets for the view, so it shouldn't be commented out...