#ed

bin+lib add-ed

Embeddable pure rust editor based on ED

15 releases

Uses new Rust 2021

0.9.0-alpha3 Jun 14, 2022
0.9.0-alpha2 May 27, 2022
0.8.0 Aug 3, 2021
0.7.7 Jun 10, 2021
0.5.1 May 19, 2021

#21 in Text editors

Download history 5/week @ 2022-03-06 62/week @ 2022-03-13 42/week @ 2022-03-20 3/week @ 2022-03-27 7/week @ 2022-04-03 6/week @ 2022-04-10 5/week @ 2022-04-17 17/week @ 2022-04-24 29/week @ 2022-05-01 89/week @ 2022-05-08 210/week @ 2022-05-15 91/week @ 2022-05-22 118/week @ 2022-05-29 104/week @ 2022-06-05 40/week @ 2022-06-12 10/week @ 2022-06-19

302 downloads per month
Used in hired

MIT license

92KB
2K SLoC

Add-ED

The standard editor, now as a library

Some time ago I decided to write an ED clone with syntax highlighting, (hired)[https://github.com/sidju/hired]. On my way to that I found that the macro commands ('g', 'v', 'G', 'V') pretty much require that you write an ED library for them. So I did, and here it is.

Early APIs

Currently it is based on both my experiences with hired and the hired repo specifically (a manual fork, so it has the whole history). This may well mean the API is ill suited for your use. If that is the case I'd be happy to make some changes to make it more general.

Core concepts

The selection:

The original ED keeps track of the last line you interacted with and defaults to working on that for most commands. I felt this deserved expanding, so add-ed instead tracks the last span of lines you interacted with. My hope is that this is more intuitive. (To avoid unpleasantries such as partial saving some commands default to the whole buffer instead. Such as 'w', the save command.)

Flexible APIs

The library has been designed with clear traits to enable changing out most components easily. For example it should be somewhat easy to create a SSH+sed Buffer implementation for remote editing, or a GUI frontend implementing the UI trait.

Feature flags:

vecbuffer:

Include and expose a simple in-memory buffer implementation

initial_input_data:

Add 'C' command. This modifies the UI trait.

Attributions:

This project has greatly benefited from regex. Not only in use of this incredible crate but also through some advice in less than fully thought out issues.

Dependencies

~230KB