Crate add_ed

Source
Expand description

Add-Ed is a library implementing the parsing, IO and runtime for Ed in rust.

Behaviour is initially based off of GNU Ed with modifications to improve on usability. See the readme and release notes for details.

This library exports two traits, IO and UI, which define the exchangeable parts of the editor. If you enable the local_io feature there is a ready implementation of the IO, but you will need to bring your own UI if you wish to do any user interaction. If you don’t wish to do any user interaction, ScriptedUI should be quite easy to use.

Minimal scripted usage example:

use add_ed::{
  ui::ScriptedUI,
  io::LocalIO,
  Ed,
  EdError,
};

// Construct all the components
let mut ui = ScriptedUI{
  input: vec![format!("e {}\n", "Cargo.toml")].into(),
  print_ui: None,
};
let macro_store = std::collections::HashMap::new();
let mut io = LocalIO::new();
// Construct and run ed
let mut ed = Ed::new(&mut io, &macro_store);
ed.run(&mut ui)?;

A full example of how to use this library is in src/bin/classic-ed.rs

Re-exports§

pub use error::Result;
pub use error::EdError;

Modules§

error
Holds Error type for the crate
io
Defines IO Trait, LocalIO (if enabled) and some testing implementations.
macros
messages
ui
Defines UI trait and some testing implementations

Structs§

Buffer
Declare a type over Vec, to be able to add some utility methods
Clipboard
Declare a type over Vec, to be able to add some utility methods
Ed
The state variable used to track the editor’s internal state.
History
A history abstraction over generic objects used by add-ed.
Line
Text data and metadata for a single line of text
LineText
An immutable text data container for a single line of text
LinesIter
The iterator returned by [Ed::get_selection]
PubLine
A fully public version of the Line struct
Substitution
A ready parsed ‘s’ invocation, including command and printing flags
TaggedLinesIter
The iterator returned by [Ed::get_tagged_selection]