Commit b79b2577 authored by Sag0Sag0's avatar Sag0Sag0

May this be the last commit

parent f3c1b862
......@@ -15,10 +15,6 @@ exclude = [
[lib]
name = "liner"
[[bin]]
name = "liner_test"
path = "src/examples/main.rs"
[dependencies]
bytecount = "0.3.1"
termion = "1.4.0"
......
......@@ -811,7 +811,7 @@ mod tests {
fn delete_all_after_cursor_undo() {
let mut context = Context::new();
let out = Vec::new();
let mut ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let mut ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
ed.insert_str_after_cursor("delete all of this").unwrap();
ed.move_cursor_to_start_of_line().unwrap();
ed.delete_all_after_cursor().unwrap();
......@@ -824,7 +824,7 @@ mod tests {
let mut context = Context::new();
let closure = |s: &str| {String::from(s)};
let out = Vec::new();
let mut ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let mut ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
ed.insert_str_after_cursor("let").unwrap();
assert_eq!(ed.cursor, 3);
......@@ -840,7 +840,7 @@ mod tests {
fn cursor_movement() {
let mut context = Context::new();
let out = Vec::new();
let mut ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let mut ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
ed.insert_str_after_cursor("right").unwrap();
assert_eq!(ed.cursor, 5);
......@@ -853,7 +853,7 @@ mod tests {
fn delete_until_backwards() {
let mut context = Context::new();
let out = Vec::new();
let mut ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let mut ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
ed.insert_str_after_cursor("right").unwrap();
assert_eq!(ed.cursor, 5);
......@@ -866,7 +866,7 @@ mod tests {
fn delete_until_forwards() {
let mut context = Context::new();
let out = Vec::new();
let mut ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let mut ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
ed.insert_str_after_cursor("right").unwrap();
ed.cursor = 0;
......@@ -879,7 +879,7 @@ mod tests {
fn delete_until() {
let mut context = Context::new();
let out = Vec::new();
let mut ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let mut ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
ed.insert_str_after_cursor("right").unwrap();
ed.cursor = 4;
......@@ -892,7 +892,7 @@ mod tests {
fn delete_until_inclusive() {
let mut context = Context::new();
let out = Vec::new();
let mut ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let mut ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
ed.insert_str_after_cursor("right").unwrap();
ed.cursor = 4;
......
......@@ -211,7 +211,7 @@ mod tests {
fn enter_is_done() {
let mut context = Context::new();
let out = Vec::new();
let ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
let mut map = Emacs::new(ed);
map.ed.insert_str_after_cursor("done").unwrap();
assert_eq!(map.ed.cursor(), 4);
......@@ -226,7 +226,7 @@ mod tests {
fn move_cursor_left() {
let mut context = Context::new();
let out = Vec::new();
let ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
let mut map = Emacs::new(ed);
map.editor_mut().insert_str_after_cursor("let").unwrap();
assert_eq!(map.ed.cursor(), 3);
......@@ -241,7 +241,7 @@ mod tests {
fn move_word() {
let mut context = Context::new();
let out = Vec::new();
let ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
let mut map = Emacs::new(ed);
map.editor_mut().insert_str_after_cursor("abc def ghi").unwrap();
assert_eq!(map.ed.cursor(), 11);
......@@ -261,7 +261,7 @@ mod tests {
fn cursor_movement() {
let mut context = Context::new();
let out = Vec::new();
let ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
let mut map = Emacs::new(ed);
map.ed.insert_str_after_cursor("right").unwrap();
assert_eq!(map.ed.cursor(), 5);
......@@ -276,7 +276,7 @@ mod tests {
fn ctrl_h() {
let mut context = Context::new();
let out = Vec::new();
let ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
let mut map = Emacs::new(ed);
map.ed.insert_str_after_cursor("not empty").unwrap();
......
......@@ -99,7 +99,7 @@ mod tests {
fn ctrl_d_empty() {
let mut context = Context::new();
let out = Vec::new();
let ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
let mut map = TestKeyMap::new(ed);
let res = map.handle_key(Ctrl('d'), &mut |_| {});
......@@ -112,7 +112,7 @@ mod tests {
fn ctrl_d_non_empty() {
let mut context = Context::new();
let out = Vec::new();
let ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
let mut map = TestKeyMap::new(ed);
map.ed.insert_str_after_cursor("not empty").unwrap();
......@@ -125,7 +125,7 @@ mod tests {
fn ctrl_c() {
let mut context = Context::new();
let out = Vec::new();
let ed = Editor::new(out, "prompt".to_owned(), Some(Box::new(|s| String::from(s))), &mut context).unwrap();
let ed = Editor::new(out, "prompt".to_owned(), None, &mut context).unwrap();
let mut map = TestKeyMap::new(ed);
let res = map.handle_key(Ctrl('c'), &mut |_| {});
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment