🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #130

Editor design & Buffer Gap

#130
From: Anthony Howe
Date: Sun, 11 Oct 2026 13:05
48 lines
3625 bytes
On 2026-08-17 09:46, Johann 'Myrkraverk' Oskarsson wrote:
>                                                    Of course we want to
> discuss how to make editors in comp.lang.c.  Finseth wrote a great book
> about how to make an Emacs in C, so I've re-added comp.lang.c, and also
> added comp.emacs, because who doesn't want to know about completely for-
> eign implementation of Emacs from scratch?
> 
> So, everyone interested in the subject can just head over to
> 
>    https://www.finseth.com/craft/
> 
> grab a copy of the PDF, and /read/ how to make an Emacs, in C.

I have implemented two editors in the `vi(1)` style that used "Buffer Gap" as 
discussed in Finseth's book, which I bought as hard copy long ago.  It was 
central to both.

`eh` was an IOCCC 2024 winner.  The full version provides more features, but 
still is a very small `vi`.  Version 1.9.0 supports UTF8, arrow keys, and paging 
in insert mode, along with a `Gold-Key`.  Together these tweaks are essentially 
a hybrid between vi and emacs.  Wouldn't take much to modify the front-end and 
go full emacs, or joe, or nano.  https://codeberg.org/SirWumpus/eh

`ae` was an IOCCC 1991 winner, a `vi` in 1536 bytes of C source code.  The 1993 
version allowed for configuration as either modal `vi` like or modeless `emacs` 
like.  https://github.com/SirWumpus/ioccc-ae

There are two aspects of an editor:

* the underling edit & storage engine (buffer-gap, link-list lines, Berkeley DB, 
rope, etc.)  See https://en.wikipedia.org/wiki/Gap_buffer#See_also lists several.

* the user interface (ed, vi, emacs, xedit/kedit, touch screen/stylus, ...)

* target environment (ok, two part design expressed as a trilogy).

The designing the edit engine is what fascinates me, regardless of UI.  Pity 
there are few discussions any more around this topic.

UI is influenced by the history of interface hardware: teletype printers, serial 
cable terminals, block-mode terminals, PC, PDAs + stylus, fondle slabs 
(tablets/smart phones), voice, "mind control"/direct human interface.  These are 
all interesting too, but they rely on the edit engine to do the work.

-- 
Anthony C Howe
achowe@snert.com                              BarricadeMX & Milters
http://nanozen.snert.com/              https://github.com/SirWumpus
Technical Details
Message-ID: <11ag1j1$2lam4$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <slrn1184atm.1fe.zaydm@new.localdomain> <115tgk1$hmg2$2@kst.eternal-september.org> <1hEgS.428964$DOD1.142122@fx17.ams4>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Anthony Howe <achowe@snert.com>
Newsgroups: comp.editors,comp.lang.c
Subject: Editor design & Buffer Gap
Date: Sun, 11 Oct 2026 09:05:36 -0400
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <11ag1j1$2lam4$1@dont-email.me>
References: <slrn1184atm.1fe.zaydm@new.localdomain>
 <115tgk1$hmg2$2@kst.eternal-september.org>
 <1hEgS.428964$DOD1.142122@fx17.ams4>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 11 Oct 2026 13:05:38 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2796228"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+uSKdXnXOy/CfxETO0AAD2"; posting-host="bff9d8d38a8a49e8e3f128a8ed39b312"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:yCnlB4B/rS3SZAH+ZvS+xebNsQs= sha256:KfR0g3gjRrHV3/y0RI/32TiGH6vpfmNttLG+yi/GOWI=
	sha1:VrvlHY2d7itBuvwaqo7MQCrpejY= sha256:niB2n54bK0st5GjNpKo5po1xoinOxIglD0YhvYPflS8=
Content-Language: en-GB, fr
In-Reply-To: <1hEgS.428964$DOD1.142122@fx17.ams4>