Live data from Hacker News

Build Your Own Text Editor

viewsourcecode.org

131–140 of 164 posts

Re: Build Your Own Text Editor

#131

Earlier quoted context omitted.

Another thing to like is it has no configuration files. This mattered a great deal in the DOS days because floppies were so slow! But even today, who wants to futz with such? If it needs configuring, I just tweak the code and recompile it. Back in the 80s, I handled configuration by having ME directly patch the ME executable. (This was a trick I learned from the old ADVENT Fortran game.) It was marvelously simple and…

I wrote quite a few DOS programs in the late 80's/early 90's that used ini files appended to the .exe as the configuration. All you had to do was run `copy prog.exe + config.ini program.exe` to build a single file that could be passed around without worrying about either a lost or changeable config file. Your code just needed to read its own exe header to figure out where to offset into it to pull out the ini content…

That's an interesting technique.

Mine was a matter of grouping the global variables for configuration together. Take the address of it, compute the offset of that address in the .exe file, and write.

Re: Build Your Own Text Editor

#132

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…

> getting the feel for design/architecture of medium-sized systems

Yes. This is exactly the kind of thing I was once looking for, only I didn't know how best to phrase at the time. Think I've since found some of the details I needed then, but will look into these nonetheless and see what I missed, if anything.

Thanks!

Re: Build Your Own Text Editor

#133
post #69

marginally relevant: I was looking for a terminal text editor for git commits and other similarly simple tasks: my only requirement is that I can save&leave with ^D. Any suggestions?

Simplest I can think of: $ echo 'cat > "$@"' >editor $ chmod +x editor $ GIT_EDITOR=./editor git commit -a stuff [master b2d3915] stuff 1 file changed, 1 insertion(+) You'll need to hit enter before ^D. You can add simple Emacs-like keybindings by changing that into $ echo 'rlwrap cat > "$@"' >editor Or just learn ed: $ GIT_EDITOR=ed git commit --amend -a 256 1c stuff and more stuff . w 271 [master c5092a6] stuff and…

Thanks for the tips!

Re: Build Your Own Text Editor

#134
post #101

for some strange reason the 'Fira Mono' google font is displaying all &s as |s. Anyone else seeing this? Cool book though, I'm going to work through it this weekend.

See https://github.com/snaptoken/kilo-tutorial/issues/4

You may have a broken version of the font locally. If you download the offline version of the tutorial, it'll come with all the fonts it uses and hopefully will work.

Re: Build Your Own Text Editor

#135

Earlier quoted context omitted.

Over at howl.io we've been working on another Lua/moonscript based editor. Incidentally it used scintilla as well until we switched to an in-house engine called aullar. The author wrote a blog post about it: https://howl.io/blog/2016/05/26/introducing-aullar.html

I want to get into that when I get time - an editor with LuaJIT - that should be brilliant.

Yes it's great. Interfacing with new libraries is easy with LuaJIT's FFI and implementing low level stuff works well too (e.g. something like reverse find on a string basically gets JITted to C speed).

Re: Build Your Own Text Editor

#136

It's my birthday today and after a peaceful morning routine I hadn't yet decided what I would do today except that I would do whatever I felt like doing. I felt like writing a text editor in C.

Happy (belated) birthday, friend! I hope you had a good day.

How far did you end up getting with the C editor? :)

Re: Build Your Own Text Editor

#137

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…

Do you have anything similar that you would recommend?

This comes to mind:

https://cheatdeath.github.io/research-bittorrent-doc/

Re: Build Your Own Text Editor

#138

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…

> While there are many large successful open source applications, many are overwhelming to read and learn from.

As long as the first commit isn't something like 'import to git' or 'add the code' (which seem to be tragically frequent) I find VCS a huge help here. The problem is that large OSS applications are (tautalogically) large. VCS allow cutting it back, and showing the evolution.

Re: Build Your Own Text Editor

#139

Earlier quoted context omitted.

No. Parent is correct. Writing code just to show how clever you are, at the expense of others who need to debug and understand it later, is poor taste.

It's pretty weird to see "correct" justified by calling the opposite "poor taste". We're talking about a mismatch between a style of code and certain tools; a better answer is to use tools that work well with the style of code you like.

It's not just tooling. The more complex the expression, the more likely it would aid in understanding if you gave it a name.

Re: Build Your Own Text Editor

#140
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.

I used to ~20 years ago. It was a curses-based mini-emacs in C; the fun part was a notebook-style interface to a Forth-like language I added in. Eventually I wanted the same kind of interface for Python programming in Emacs, and moved on to that with https://github.com/darius/halp .

I just tried halp, it seems pretty cool, thank you for making it available!
Post reply on HN