How to write a text editor in C ++

I studied C ++ several times, but never wrote real applications using it. For a long time I thought that writing a text editor would be something very interesting, now I am looking for a simple but decent text editor written in c or C ++, from which I can get inspiration and learn how to write a text editor myself,

Could you guys recommend me a "simple but decent" text editor written in c or C ++?

+21
c ++
Oct 05 '09 at 13:17
source share
9 answers

Well, what you want to see is more like a tutorial than a real application (I think applications like Notepad ++ will be a lot to dive into at the beginning). Since you are not specifying any environment you want to program into, you can check out the QT text editor . QT is a cross-platform GUI Toolkit, so you are not tied to a specific operating system, but it is probably harder to set up Visual Studio on Windows.

For Windows only, you might consider digging more into the .NET platform (e.g. C #), as suggested in this question . This does not help to learn C ++, but makes GUI development a lot easier.

+9
05 Oct '09 at 13:30
source share

You can watch Zile or nvi . Both are fairly simple; Zile is Emacs-like, and nvi is Berkeley vi . Another look at this would be Nano , a simple text editor that would be easy for new users. I do not know how clean the code on any of them is.

I would also recommend reading The Craft of Text Editing: Emacs for the modern world . This book discusses many of the specific problems that need to be addressed when writing a text editor along with approaches, strategies, and algorithms for solving them. Its content should be relevant and useful, even if your editor does not look like Emacs at all.

+19
Oct 05 '09 at 13:30
source share

Get vi. There is a big drawback of real editors like vi / vim;) I mean that there are many editors like notepad / notepad ++, but several editors that have a separate control / management mode. So, you can look at vi sources to inspire yourself and introduce something revolutionary.

+4
Oct 05 '09 at 13:30
source share

Notepad ++ is a great open source editor written in C ++.

+4
05 Oct '09 at 13:32
source share

Notepad ++ for some definitions of "simple."

+2
Oct 05 '09 at 13:29
source share

You can also check out the Scintilla editing component.

+2
Oct 05 '09 at 13:35
source share

JuffEd . It is written in C ++, a cross platform due to the use of Qt and QScintilla. Notepad ++ also uses the Scintilla text editor, but it is limited only to the Windows platform.

+1
Oct 05 '09 at 13:33
source share

Which text editor do you want to do?

First question: will it be a GUI or console?

Based on the GUI, do you want to do something like Notepad? And on which platform? If it depends on MS Windows, can I recommend collecting MFC?

If it is text based, there are many open source solutions you can fall into. My recommendation is to look at the simplest editors like ed or something like that.

+1
05 Oct '09 at 13:40
source share

loot to QT is a cross-platform, HAS RICHTEXT COMPONENT (widget). Writing the first application in QT will give you factual knowledge. I recommend learning QT from a book

0
Oct 05 '09 at 13:34
source share



All Articles