digitalmars.D - Writing text editor from scratch in D & Raylib
- madwebness (57/57) Apr 04 Hi everyone. Decided to share my work after almost a year of slow
- madwebness (2/3) Apr 04 Oh, I completely forgot to post the link to the source code:
- Kapendev (3/6) Apr 04 Looks cool. I never was a fan of vim motions, but I will try it
- madwebness (6/7) Apr 04 You can re-assign everything to you liking conf/cmdmap.conf, it's
- Sergey (4/7) Apr 05 Recently I found an interesting project in C + Clay + SDL
- madwebness (23/26) Apr 05 Yep, thank you, interesting project. One thing I wish I could do
- Adam D. Ruppe (5/7) Apr 05 It has worked in OpenD for over a year now. What doesn't work
- Kapendev (7/16) Apr 06 Parin includes some information about compiling raylib-d projects
- Kapendev (6/23) Apr 06 This might also help: https://github.com/crazymonkyyy/raylib-2024
- Serg Gini (8/18) Apr 06 Don't know much about text editors,
- matheus (23/26) Apr 04 Do you use any kind of model like buffer gap or anything like
- madwebness (8/11) Apr 04 Deliberate choice on my part: I don't care about large files.
- matheus (9/20) Apr 04 Not only big source files, well there was this source (Build
Hi everyone. Decided to share my work after almost a year of slow grind. "ick" is a text editor I am writing in D. One of my main goals is to keep the codebase small, readable, and easy to understand -- so it's not just features, but about making an editor that stays hackable and maintainable over time and avoid turning into a mess. Here's a short [video demonstration](https://qount25.dev/video/ick_syntax_highlihght_2.mp4) If you're still here and interested, here's an overview of what ick can currently do and how it's designed: * Internally, it's a pretty simple model: there's document, lines, cursor, viewport, grid, syntax spans... * A lot of behavior is config-driven. Key bindings, syntax schemes, syntax themes, GUI theme, fonts are all loaded from files. * Syntax highlight doesn't use tree-sitter (too complex) or LSPs (complex & slow). Instead I picked an unusual approach wherein I use "steps" of small regexes and custom D functions which pick spans on each line, which are then highlighted. There are "schemes", "themes" (applies to schemes) and also "editor themes", which are planned to basically modify themes on the fly so colors match better. This makes it extremely flexible and fast. Also, because I don't care about LSPs or tree-sitter, syntax highlight doesn't actually have to follow language syntax - this enabled a lot of interesting things. * Rendering is based on a grid/cell model, which keeps the GUI side conceptually simple. It's not the bestest, as they say, but I think simplicity is more important. Also yes, it only works well with mono fonts. * Commands... Firstly, you get the usual kind of editor behavior you'd expect from Vim or Kakoune or Helix: different modes, movement, editing, numeric prefixes, leader-style sequences, staged commands (they work a bit differently than Vim, better I'd say) that wait for a motion or selection etc. All bindings are loaded from a config file. Every binding executes one or more commands, and while commands themselves are D functions -- because you can stack one on top of another, it's very composable. For example, this would be the equivalent of Vim's "o" (adding new line) taken from ick's bindings config file: `o move_right(-1);insert_newline;move_down;move_line_start;switch_to_insert` So, folks, while I can't say it's very useful as of the moment (I'm still writing my code in Vim), it's getting there. I can at least say I outlined some major design, architecture and features so that the development direction is more or less clear. Would appreciate your thoughts about the code and editor itself. I don't expect anyone to be so interested as to help out with the development - and, besides, like many other programmers, it's pretty hard for me to let go of control. But I think it might be worth it to start building a small community around it, so that people at least discuss it and contribute ideas. I have a personal Element/Matrix server, where I can invite anyone who wants to contribute one way or another, even if with just the occasional conversations - so ping here or in DM if you'd like to be added. Tank you for your attention to this matter :)
Apr 04
Writing text editor from scratch in D & RaylibOh, I completely forgot to post the link to the source code: https://code.qount25.dev/qount25/ick
Apr 04
On Saturday, 4 April 2026 at 09:40:00 UTC, madwebness wrote:Looks cool. I never was a fan of vim motions, but I will try it out.Writing text editor from scratch in D & RaylibOh, I completely forgot to post the link to the source code: https://code.qount25.dev/qount25/ick
Apr 04
I never was a fan of vim motionsYou can re-assign everything to you liking conf/cmdmap.conf, it's very customizeable. NOTE: I haven't translated all of vim stuff in there, just the basics for now. So take it as a starting point and then you can invent your own bindings as you go. I will probably be adding more Vim-like bindings later though, but the idea is to let users easily re-assign all of them.
Apr 04
On Saturday, 4 April 2026 at 09:40:00 UTC, madwebness wrote:Recently I found an interesting project in C + Clay + SDL Could be interesting for you to check https://dylancobb.github.io/sev/Writing text editor from scratch in D & RaylibOh, I completely forgot to post the link to the source code: https://code.qount25.dev/qount25/ick
Apr 05
Recently I found an interesting project in C + Clay + SDL Could be interesting for you to check https://dylancobb.github.io/sev/Yep, thank you, interesting project. One thing I wish I could do is to be able to ship to WASM and the browser - which this editor can do because it's in C, but ick cannot. Raylib itself supports WASM, but D with GC doesn't, correct? Does anybody know if D + GC + maybe parts of stdlib will ever be compiling for wasm? I've also browsed through their dir structure, it's funny that I can't actually map it very well to what I've done with ick, which kinda made me feel like a hack. Their source and editor itself (from the screenshots) look more polished, but at the same time it must lack something I've implemented, because there's definitely less code as far as I can tell. I also didn't see any unit tests - don't know how is it even possible to NOT have unit test coverage for a project like text editor. Their usage of this "Clay" lib for layout is what also picked my eye. Has anyone tried it? I guess it could simplify things greatly when I get to implementing things like splits, tabs and other small UI elements, but I'm not sure I want to go that way - what if I want to support GOP rendering or some other backends later, I better have my own tiny UI lib. How hard can it be for an editor? Anyway, good link, made me think about things. And also about building proper small community, which this "sev" editor is definitely also doing.
Apr 05
On Monday, 6 April 2026 at 01:06:37 UTC, madwebness wrote:Does anybody know if D + GC + maybe parts of stdlib will ever be compiling for wasm?It has worked in OpenD for over a year now. What doesn't work today is exceptions and threads, and exceptions are likely coming soon, a patch was submitted yesterday and is undergoing testing soon.
Apr 05
On Monday, 6 April 2026 at 01:06:37 UTC, madwebness wrote:Parin includes some information about compiling raylib-d projects that use the GC and std to Wasm: https://github.com/Kapendev/parin?tab=readme-ov-file#how-do-i-make-a-web-build Just ctrl-f raylib and you will find the part I'm talking about. Feel also free to make an issue if it does not work and I will try to help.Recently I found an interesting project in C + Clay + SDL Could be interesting for you to check https://dylancobb.github.io/sev/Yep, thank you, interesting project. One thing I wish I could do is to be able to ship to WASM and the browser - which this editor can do because it's in C, but ick cannot. Raylib itself supports WASM, but D with GC doesn't, correct? Does anybody know if D + GC + maybe parts of stdlib will ever be compiling for wasm?
Apr 06
On Monday, 6 April 2026 at 08:24:18 UTC, Kapendev wrote:On Monday, 6 April 2026 at 01:06:37 UTC, madwebness wrote:This might also help: https://github.com/crazymonkyyy/raylib-2024 Just a small last note: anything sdl or raylib related on the web is not really the most stable thing **in my opinion** in any language. It's better than not being able to have a web build, of course. Also worth trying.Parin includes some information about compiling raylib-d projects that use the GC and std to Wasm: https://github.com/Kapendev/parin?tab=readme-ov-file#how-do-i-make-a-web-build Just ctrl-f raylib and you will find the part I'm talking about. Feel also free to make an issue if it does not work and I will try to help.Recently I found an interesting project in C + Clay + SDL Could be interesting for you to check https://dylancobb.github.io/sev/Yep, thank you, interesting project. One thing I wish I could do is to be able to ship to WASM and the browser - which this editor can do because it's in C, but ick cannot. Raylib itself supports WASM, but D with GC doesn't, correct? Does anybody know if D + GC + maybe parts of stdlib will ever be compiling for wasm?
Apr 06
On Monday, 6 April 2026 at 01:06:37 UTC, madwebness wrote:Their usage of this "Clay" lib for layout is what also picked my eye. Has anyone tried it? I guess it could simplify things greatly when I get to implementing things like splits, tabs and other small UI elements, but I'm not sure I want to go that way - what if I want to support GOP rendering or some other backends later, I better have my own tiny UI lib. How hard can it be for an editor?Don't know much about text editors, but me and the author of the repo are trying to play with D bindings for clay.. Join the fun :) https://github.com/zkxjzmswkwl/clayd https://github.com/zkxjzmswkwl/clayuiAnyway, good link, made me think about things. And also about building proper small community, which this "sev" editor is definitely also doing.Glad that you found it useful!
Apr 06
On Saturday, 4 April 2026 at 09:37:25 UTC, madwebness wrote:Hi everyone. Decided to share my work after almost a year of slow grind. "ick" is a text editor I am writing in D...Do you use any kind of model like buffer gap or anything like that or you developed your own ? I used to write games but when going to text editor it was a nice challenge, for example loading big files, editing etc. In my case I use my own algo, where I had an array of pointers to strings of some kind of buffer gaps. Deleting/Adding lines was pretty fast, just moving pointers around. In my case even though I wrote syntax highlighting for it, I wasn't (Still not) fan of this feature, usually I use text editor in 2 colors white over black that's fit me more. Have you tried to load and compare big files against other editors? I remember a feature I had in linux where I could load files in steps and editing big files without wait to finish it, because my editor had "page files" with buffer between them, so it was a trick that made it load big files instantly while there was a multi thread job loading other pages. =] I pretty sure I used some existing linux feature for this, and since I only used linux I couldn't care for windows, but I believe this one existed there too. Good luck on your project, Matheus.
Apr 04
On Saturday, 4 April 2026 at 13:44:35 UTC, matheus wrote:On Saturday, 4 April 2026 at 09:37:25 UTC, madwebness wrote: Have you tried to load and compare big files against other editors?Deliberate choice on my part: I don't care about large files. Maybe I'll optimize for it in the future, but over my 20 year programming career, I've rarely opened a file with more than a few thousand lines of code (maybe I've been lucky). I thought it's better to have a simpler model for documents (linked list of lines) then optimize for large files and end up with something less manageable.
Apr 04
On Saturday, 4 April 2026 at 13:50:01 UTC, madwebness wrote:On Saturday, 4 April 2026 at 13:44:35 UTC, matheus wrote:Not only big source files, well there was this source (Build engine from Ken Silverman 2 or 3 big C files). But one thing there is more common is to open big log files which use to be a pain in some code editors. But yes, maybe is not something common, what could be common is to open a project with a lot of files to parse. But maybe with AI this could be resolve differently these days. Matheus.On Saturday, 4 April 2026 at 09:37:25 UTC, madwebness wrote: Have you tried to load and compare big files against other editors?Deliberate choice on my part: I don't care about large files. Maybe I'll optimize for it in the future, but over my 20 year programming career, I've rarely opened a file with more than a few thousand lines of code (maybe I've been lucky). I thought it's better to have a simpler model for documents (linked list of lines) then optimize for large files and end up with something less manageable.
Apr 04









madwebness <qount25 protonmail.com> 