views:

168

answers:

4

I've had it of those dozens of editors which never provides simple things like:

  • distinguish type keywords and instruction keywords so I can put different colors on them.
  • being cross platform using a standard GUI lib like qt gtk etc (notepad++, yes, I almost hate you).
  • enough keyboard shortcut like duplicate line, comment selection, and a decent find-replace.
  • Decent task-easing features like single-click-on-the-number-line-margin to select the entire line.
  • Scintilla or another good-enough lexer that highlights enough different things, because brain-compiling code is one thing, quickly identify with the eyes what is what is something I find important.

I just want to support very basic languages like C, C++, maybe Python, not HTML or CSS.

Is Scintilla a good choice to just highlight those languages, and is a lexer really necessary ?

Isn't QT enough to program a text editor such as the one I want to do ? I know there is QScintilla, but is there a reason I shouldn't use a lib that integrates a lexer ? Why is Scintilla such a good lib ?

Is QT a good choice for such an editor ? (I also want to hard embed ProFont in the editor to kill any reluctant font problem between OSes).

EDIT: In short, I want to make an editor, only with the same syntax highlight features of notepad++. That's my main goal, and the use of QScintilla might be a little harder than I thought...

+1  A: 

If you really want to do this (and it sounds like a lot of work) I would look at ANTLR for parsing the code. You may get some ideas from their ANTLRWorks display. To link the parse tree to a display could be a fair amount of work so I'd see what an IDE platform such as Eclipse has to offer

peter.murray.rust
+5  A: 

C++ is not a "very basic language" by any stretch of the imagination.

Why do you really want to do this? There are SOOO many open source code editors out there.

Skilldrick
It's essentially because I want an editor that looks nice to the eye: I just can't let go a dark background editor with the colors I want... The main reason I want to do this, is I'm tired of always configuring an editor I like to something I like, plus, the features I am looking for are quite simple, and always a pain to make work in an existing editor, and it's always frustrating to see all the advanced feature on an editor, without finding the simple thing that I like. I'm a nerd I know, I have my stupid standards but if I can make an editor that would be nice, especially cross platform...
gokoon
I can't personally think of a less basic language than C++
jalf
@gokoon: wouldn't it be easier to find an editor which supports the features you need, configure it for your tastes once and for all, **and then save the configuration files**? That way you might be able to get away with, say, 1 hours work, instead of a couple of man-years.
jalf
I was saying basic, I wanted to say I just want to support it, as in "popular language" and not support all kind of language like lisp python java ocaml php ruby etc, just C++. For the configuration files, that's not enough, notepad++ is not running on a mac natively, and I prefer hard coding some behaviours because sometimes they make more sense. That should ease the task a lot.
gokoon
+1  A: 

If you must write your own editor, I suggest looking at the other open source editors and examine which pieces you port to your editor.

Porting pieces of existing working and tested code is usually much better than writing your own code and debugging it.

After perusing a couple serious open source editors: Emacs, Eclips, CodeBlocks, CodeLight, etc., I believe you will start changing your mind about writing an editor from scratch.

-- Thomas Matthews
My Info

Thomas Matthews
the editors you quote are full-featured IDE, I just want to make some kind of simple notepad with syntax highlighting, a thing scintilla does... and Qt might help a lot...
gokoon