Live data from Hacker News

Build Your Own Text Editor

viewsourcecode.org

71–80 of 164 posts

Re: Build Your Own Text Editor

#71

Reference implementations of medium sized applications are incredibly useful for leveling up as a programmer. While there are many large successful open source applications, many are overwhelming to read and learn from. Having something that outlines the key features and components and which ignores the important but complicated edge cases assists in keeping the attention focused. Now if there are annotation within t…

Wholeheartedly agree. Making my own lisp was an eye opener on how programming languages work - and that's after I've read a lot of theory on the matter.

By the way, is there are similar resource for building your own relational SQL-based database?

Re: Build Your Own Text Editor

#72
Sometimes when I configure my vim, I feel like I am building an editor too :D

But at least that is more of a LEGO style of putting different bricks (plugins) together.

Re: Build Your Own Text Editor

#74

1000 lines of code is considered small. But check this out http://kparc.com/edit.k Under 50 lines for a text editor written in K by the language's author. Way beyond my present understanding, but the promise of very small, powerful code is incredibly attractive.

Just to be that guy. Yeah, it's cool that the language author built a text editor in under 50 lines, and there's a sort of geeky hacky appeal to trying to cram as much functionality as possible into as small a space as possible.

But what does it actually mean in terms of programming? How maintainable is "small code"? How readable is it? (Well, you answered that question already.) How hackable is it?

It's a curiosity, and a really fun one! But it's not practical.

Re: Build Your Own Text Editor

#75

Here's one from the 1980s, which I still use and keep up to date: https://github.com/DigitalMars/me and translated to D: https://github.com/DigitalMars/med

A trivial thing, but README.md for me says "Micro Emacs in D", where it should say "Micro Emacs in C" (the repo description on Github is correct though).

Re: Build Your Own Text Editor

#76

Earlier quoted context omitted.

Fair enough. But where do you see multistatement lines in the link?

For example: https://github.com/martanne/vis/blob/master/buffer.c bool buffer_prepend0(Buffer buf, const char data) { return buffer_prepend(buf, data, strlen(data) + (buf->len == 0)); } Two function calls plus arithmetics plus step-return. Depending on the debugger interface(eclipse with gdb, vs, etc), one will have to press some form of Step 1 to 4 times to advance the line. Depending on the complier that was suppos…

How would you rewrite it? Would you use a local variable for the result from strlen(), for example?

Re: Build Your Own Text Editor

#77

Reference implementations of medium sized applications are incredibly useful for leveling up as a programmer. While there are many large successful open source applications, many are overwhelming to read and learn from. Having something that outlines the key features and components and which ignores the important but complicated edge cases assists in keeping the attention focused. Now if there are annotation within t…

I found that another hard thing that feels like a prerequisite for leveling up further is getting the feel for design/architecture of medium-sized systems. There's a pretty awesome resource for that particular need - the series of books called "The Architecture of Open Source Applications".

http://aosabook.org/en/index.html

(The books are CC and free to read on-line :))

I'm just through the few first chapters of the first book, and I must say it's absolutely amazing. Each chapter gives some understanding of the thought process people designing (and iterating on) a known open-source project had.

Re: Build Your Own Text Editor

#78

Scite is a barebone open source text editor created by Neil Hodgson to exercise his "Scintilla" text-editor c++ library which is used in others like notepad++. In hindsight, I would have a bit more caution programming text editors. I started tweaking and modifying Scite years ago, it was very interesting but it was no small undertaking and I came to understand why Neil advised in the support forum, to customise it us…

I wrote an open source editor with some buddies 10 years ago and still use it on a daily bases. That was built around codemax. A month ago, me and one of those friends picked it up again for a new revision and started retooling using Scintilla. Scintilla is an amazing control, very well documented and it has a lot of features.

Some of the standard features from codemax have to be rebuilt, but I'm still very impressed. Oh and before somebody plugs their favorite editor and why I should be using that instead, if it doesn't know DataFlex it won't help ;)

Re: Build Your Own Text Editor

#79
post #33

I'm curious if anyone here regularly codes in a text editor they wrote themselves? I've often thought of coding one for fun, with no intention to share it, just for the purpose of having a long-term project that evolves along with my skills. I've never made time for it, but I still consider it once in a while.

Yes, pretty much all of my code is written in an editor called "The Hammer". It is written in DataFlex and some C++ bits and pieces.

Re: Build Your Own Text Editor

#80
post #47

The next fun experiment is to handle gigabyte files without undue performance troubles with a lively ui thread! This is where scintilla et al run into limits.

Scintilla is an editor for source code. Normally code isn't gigabytes in size and doesn't need a lexer, code folding or syntax highlighting. Not saying that it can't be done, but if you open a file like that then turning off those features would already make it a lot easier to handle huge files.
Post reply on HN