View unanswered posts | View active topics It is currently Sat Nov 29, 2014 3:25 am



Reply to topic  [ 7 posts ] 
 Making a code Editor 
Author Message

Joined: Mon Jul 20, 2009 2:52 pm
Posts: 8
Post Making a code Editor
Hi Everyone,

I am trying to make a code editor in basic I was wondering what is a good way to colour chars in a text editor. I have a way to change the colours in a text editor but I find it is very slow checking the document when I am writing in side. The main problem is with things like " or '

I want it to colour anything blue inside those chars. But they can spread accross several lines.

Please does anyone has any suggestions?

Thanks,

Cameron.


Tue Aug 03, 2010 4:03 pm
Profile
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 291
Post 
First, there are a billion editors, so just look at them. Second, this is a personal taste thing that's why all editors allow you to change the colors of the foreground, background text, comments, keywords, etc. Thus, you need to do this, have a little dialog that let's you set all the colors as a set, then have a handful of default settings like; windows standard, retro, Atari, high contrast, etc.

Andre'


Tue Aug 03, 2010 5:49 pm
Profile WWW

Joined: Mon Jul 20, 2009 2:52 pm
Posts: 8
Post 
Hi Andre,

Thank you for your reply. I am not really talking about how to setup colours in a text editor. I am talking about how to make an editor. I find that my loops take too long to complete. How did you guys go about making your stuff?

Cheers,

Cameron


Wed Aug 04, 2010 1:48 pm
Profile
User avatar

Joined: Tue Dec 06, 2005 8:01 am
Posts: 23
Location: U.S.A.
Post 
cameronasmith wrote:
Hi Andre,

Thank you for your reply. I am not really talking about how to setup colours in a text editor. I am talking about how to make an editor. I find that my loops take too long to complete. How did you guys go about making your stuff?

Cheers,

Cameron


Which loops specifically Cameron? You're coding this with BASIC too you said, which dialect of BASIC?

That'll help us help you a little better.

_________________
The wolf and his mate howl, taking solace in the silver moon. Pressing ever foreward to see what the future holds.

Mao Mao Games


Wed Aug 04, 2010 2:05 pm
Profile WWW

Joined: Mon Jul 20, 2009 2:52 pm
Posts: 8
Post 
Hi Thanks for your reply,

I am making it in RealBASIC and the loops are to scan thurth the current lines to find if I should apply colour or not. So for example if someone types the char " I can the line until i see another " and stop the colour from their. This seems to cause a lot of work for the computer :S

Any help please


Wed Aug 04, 2010 4:11 pm
Profile
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 291
Post 
I see what you're saying, well sounds like your optimization skills needs work :) This is what happens when you run i5, i7s at 3 GHz, you get sloppy :) Anyway, you need to look at your representation of your data and use a more efficient method to search the text, also, you need to compute where highlighting is going ONCE on the fly, then update the data structure, for example.

The sentence:

This is a sentence "now everything in the quotes" should be blue!

But, if I change the sentence to :

This is a new sentence "now everything in the quotes" should be blue!

I only change a part of the sentence that has nothing to do with the quoted text, thus since I have ADDED any quotes, there is NO need to scan for quotes, all I need to do is update the position of the texthighlighting and NOT search the text, thus I need a linked list of pointers to the sections that are quoted, etc.

So, the point is to create dynamic data structures that give information and hints to what you need to do, so you don't have to scan every single keystroke and make updates --

Andre'


Wed Aug 04, 2010 7:56 pm
Profile WWW

Joined: Mon Jul 20, 2009 2:52 pm
Posts: 8
Post 
Thanks Andre,

I will take your suggestions


Thu Aug 05, 2010 1:24 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.