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

Modules

  • Holds Error type for the crate
  • Defines IO Trait, LocalIO (if enabled) and some testing implementations.
  • Defines UI trait and some testing implementations

Structs

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