Navigation
« 

Anonymous




Register
Login
« 
« 

Amiga Future

« 

Community

« 

Knowledge

« 

Last Magazine

The Amiga Future 167 was released on the March 5th.

The Amiga Future 167 was released on the March 5th.
The Amiga Future 167 was released on the March 5th.

The Amiga Future 167 was released on the March 5th.
More informations

« 

Service

« 

Search




Advanced search

Unanswered topics
Active topics
« 

Social Media

Twitter Amigafuture Facebook Amigafuture RSS-Feed [german] Amigafuture RSS-Feed [english] Instagram YouTube Patreon
« 

Advertisement

Amazon

Patreon

« 

Partnerlinks

Syntax highlighting

Support CygnusEd

Moderators: AndreasM, olsen

Post Reply
Kamelito
Grade reingestolpert
Grade reingestolpert
Posts: 2
Joined: 31.07.2022 - 14:26

Syntax highlighting

Post by Kamelito »

Olsen,
Is syntax highlighting planned for CED?
68k and C would be great.

Bubba42 wishes are pretty nice too :

“ Code folding (check how Notepad++ implements this)
- The ability to split the window vertically ”
Kamel
olsen
CygnusEd Developer
Posts: 167
Joined: 06.06.2006 - 16:27

Re: Syntax highlighting

Post by olsen »

Kamelito wrote: 31.07.2022 - 14:33 Olsen,
Is syntax highlighting planned for CED?
68k and C would be great.

Bubba42 wishes are pretty nice too :

“ Code folding (check how Notepad++ implements this)
- The ability to split the window vertically ”
Kamel
This is exceptionally tough to implement. I already looked into this a few years ago and the big obstacle here is that CygnusEd's architecture would have to be revamped.

CygnusEd is designed, from the bottom up, to be exceptionally fast in rendering and editing text, even on the original Amiga 1000 and the humble Amiga 500. This is achieved by keeping the entire text in a consecutive buffer in memory, with the rendering and editing operations built around having access to this consecutive buffer in which every single byte is a character or line break. CygnusEd has no data structures beyond this buffer to break down the text into lines, rows, words and columns. The text renderer figures out which characters are line breaks and CygnusEd uses this to break the buffer into rows. Editing uses a dedicated line buffer (fixed size: lines may not be longer than 32000 characters) whose contents get swapped in/out of the main buffer as needed, moving the contents of the text buffer around if necessary, or allocating a new, larger text buffer, then copying the contents of the old buffer into it as the file grows. The search & replace operations as well as the ARexx interface functions rely upon the text to be in that consecutive buffer.

All the things made possible by having dedicated document data structures, such as syntax highlighting and folding, are unavailable to CygnusEd unless one constructed a shadow copy of the document in memory which overlays the buffer contents. This would be doable, but the problems pile up: how do you efficiently resync the state of the shadow copy and buffer contents? I have not been able to come up with even a decent proof of concept for that.

Splitting the views horizontally (splitting the window into a stack of views is the default behaviour) is not one of those features which are made harder to implement because of CygnusEd's architectural limitations. This would be feasible. However, the feature would have to play well with the ARexx interface functions. Views are currently assumed to be in vertical order and a horizontal split would have to accommodate that.

Such are the challenges of a 35 year old text editor codebase, I'm afraid :(
Kamelito
Grade reingestolpert
Grade reingestolpert
Posts: 2
Joined: 31.07.2022 - 14:26

Re: Syntax highlighting

Post by Kamelito »

Thanks for answering. Is it coded in C or ASM? Maybe both?
If the text is displayed using OS functions I guess a patch could be maybe to check if the task is CED and if this task is printing text then add colors to keywords this will make syntax highlighting possible without having to modify CED but I guess it may be slow.
olsen
CygnusEd Developer
Posts: 167
Joined: 06.06.2006 - 16:27

Re: Syntax highlighting

Post by olsen »

Kamelito wrote: 04.08.2022 - 23:56 Thanks for answering. Is it coded in C or ASM? Maybe both?
It is written almost entirely in 'C' for the AmigaOS 68k version. The assembly language portions are a good example of how to choose which portion of a large application would benefit the most from writing it in assembly language and then continuously optimizing it over the years. This is the text bitmap rendering code (for 8x8 bitmap fonts), the buffer contents rendering code which deals with breaking the buffer contents into characters and line breaks as well as handling tab stops and (last, but not least) the buffer data copying code.

With the exception of the buffer data copying code I rewrote all of these in portable 'C' for the AmigaOS4 and MorphOS versions. The buffer data copying code became a memmove() invocation ;)

There is one small 68k assembly language portion which deals with setting up the blitter operations by directly accessing the blitter registers. This was written at a time when a 'C' compiler could accidentally produce read operations on write-only registers (never a good idea with the Amiga custom chipset). Using assembly language avoids such traps. Using the blitter in this manner is an optimization which used to make a difference for scrolling the text displayed in the views, back in the 1980'ies when graphics.library was not as optimized as it became with Kickstart 3.0. Naturally, only the AmigaOS 68k version makes use of it ;)
If the text is displayed using OS functions I guess a patch could be maybe to check if the task is CED and if this task is printing text then add colors to keywords this will make syntax highlighting possible without having to modify CED but I guess it may be slow.
It should be as fast as possible for CygnusEd, so there's the challenge and then some :(
robxbl69
Grade reingestolpert
Grade reingestolpert
Posts: 1
Joined: 27.05.2023 - 20:52

Re: Syntax highlighting

Post by robxbl69 »

Hi. I used CED 3.5 for many years in 199x and in early 2000’s left the Amiga scene, but over the last 2 years have found a new love for it.

I found 3.5 didn’t always play nicely on my (new) RTG setup, so after playing with the demo I have just purchased CED 5 which so far has fixed all the issues I was having.

I came here to ask about syntax highlighting as using UltraEdit, Notepad++, Visual Studio etc over the last 20 years it’s tricky at times (especially with me older brain!) not to have it.

I’ve read this thread and accept what you’re saying but have to ask is it possible to even add some simple highlighting of comments against code for C, AmigaDOS, ARexx and maybe others?

Thanks for all your hard work

Rob
Post Reply