Commit b79b2577 authored by Sag0Sag0's avatar Sag0Sag0

May this be the last commit

parent f3c1b862
...@@ -15,10 +15,6 @@ exclude = [ ...@@ -15,10 +15,6 @@ exclude = [
[lib] [lib]
name = "liner" name = "liner"
[[bin]]
name = "liner_test"
path = "src/examples/main.rs"
[dependencies] [dependencies]
bytecount = "0.3.1" bytecount = "0.3.1"
termion = "1.4.0" termion = "1.4.0"
......
...@@ -811,7 +811,7 @@ mod tests { ...@@ -811,7 +811,7 @@ mod tests {
fn delete_all_after_cursor_undo() { fn delete_all_after_cursor_undo() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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.insert_str_after_cursor("delete all of this").unwrap();
ed.move_cursor_to_start_of_line().unwrap(); ed.move_cursor_to_start_of_line().unwrap();
ed.delete_all_after_cursor().unwrap(); ed.delete_all_after_cursor().unwrap();
...@@ -824,7 +824,7 @@ mod tests { ...@@ -824,7 +824,7 @@ mod tests {
let mut context = Context::new(); let mut context = Context::new();
let closure = |s: &str| {String::from(s)}; let closure = |s: &str| {String::from(s)};
let out = Vec::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("let").unwrap(); ed.insert_str_after_cursor("let").unwrap();
assert_eq!(ed.cursor, 3); assert_eq!(ed.cursor, 3);
...@@ -840,7 +840,7 @@ mod tests { ...@@ -840,7 +840,7 @@ mod tests {
fn cursor_movement() { fn cursor_movement() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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.insert_str_after_cursor("right").unwrap();
assert_eq!(ed.cursor, 5); assert_eq!(ed.cursor, 5);
...@@ -853,7 +853,7 @@ mod tests { ...@@ -853,7 +853,7 @@ mod tests {
fn delete_until_backwards() { fn delete_until_backwards() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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.insert_str_after_cursor("right").unwrap();
assert_eq!(ed.cursor, 5); assert_eq!(ed.cursor, 5);
...@@ -866,7 +866,7 @@ mod tests { ...@@ -866,7 +866,7 @@ mod tests {
fn delete_until_forwards() { fn delete_until_forwards() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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.insert_str_after_cursor("right").unwrap();
ed.cursor = 0; ed.cursor = 0;
...@@ -879,7 +879,7 @@ mod tests { ...@@ -879,7 +879,7 @@ mod tests {
fn delete_until() { fn delete_until() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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.insert_str_after_cursor("right").unwrap();
ed.cursor = 4; ed.cursor = 4;
...@@ -892,7 +892,7 @@ mod tests { ...@@ -892,7 +892,7 @@ mod tests {
fn delete_until_inclusive() { fn delete_until_inclusive() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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.insert_str_after_cursor("right").unwrap();
ed.cursor = 4; ed.cursor = 4;
......
...@@ -211,7 +211,7 @@ mod tests { ...@@ -211,7 +211,7 @@ mod tests {
fn enter_is_done() { fn enter_is_done() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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); let mut map = Emacs::new(ed);
map.ed.insert_str_after_cursor("done").unwrap(); map.ed.insert_str_after_cursor("done").unwrap();
assert_eq!(map.ed.cursor(), 4); assert_eq!(map.ed.cursor(), 4);
...@@ -226,7 +226,7 @@ mod tests { ...@@ -226,7 +226,7 @@ mod tests {
fn move_cursor_left() { fn move_cursor_left() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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); let mut map = Emacs::new(ed);
map.editor_mut().insert_str_after_cursor("let").unwrap(); map.editor_mut().insert_str_after_cursor("let").unwrap();
assert_eq!(map.ed.cursor(), 3); assert_eq!(map.ed.cursor(), 3);
...@@ -241,7 +241,7 @@ mod tests { ...@@ -241,7 +241,7 @@ mod tests {
fn move_word() { fn move_word() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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); let mut map = Emacs::new(ed);
map.editor_mut().insert_str_after_cursor("abc def ghi").unwrap(); map.editor_mut().insert_str_after_cursor("abc def ghi").unwrap();
assert_eq!(map.ed.cursor(), 11); assert_eq!(map.ed.cursor(), 11);
...@@ -261,7 +261,7 @@ mod tests { ...@@ -261,7 +261,7 @@ mod tests {
fn cursor_movement() { fn cursor_movement() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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); let mut map = Emacs::new(ed);
map.ed.insert_str_after_cursor("right").unwrap(); map.ed.insert_str_after_cursor("right").unwrap();
assert_eq!(map.ed.cursor(), 5); assert_eq!(map.ed.cursor(), 5);
...@@ -276,7 +276,7 @@ mod tests { ...@@ -276,7 +276,7 @@ mod tests {
fn ctrl_h() { fn ctrl_h() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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); let mut map = Emacs::new(ed);
map.ed.insert_str_after_cursor("not empty").unwrap(); map.ed.insert_str_after_cursor("not empty").unwrap();
......
...@@ -99,7 +99,7 @@ mod tests { ...@@ -99,7 +99,7 @@ mod tests {
fn ctrl_d_empty() { fn ctrl_d_empty() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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 mut map = TestKeyMap::new(ed);
let res = map.handle_key(Ctrl('d'), &mut |_| {}); let res = map.handle_key(Ctrl('d'), &mut |_| {});
...@@ -112,7 +112,7 @@ mod tests { ...@@ -112,7 +112,7 @@ mod tests {
fn ctrl_d_non_empty() { fn ctrl_d_non_empty() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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 mut map = TestKeyMap::new(ed);
map.ed.insert_str_after_cursor("not empty").unwrap(); map.ed.insert_str_after_cursor("not empty").unwrap();
...@@ -125,7 +125,7 @@ mod tests { ...@@ -125,7 +125,7 @@ mod tests {
fn ctrl_c() { fn ctrl_c() {
let mut context = Context::new(); let mut context = Context::new();
let out = Vec::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 mut map = TestKeyMap::new(ed);
let res = map.handle_key(Ctrl('c'), &mut |_| {}); 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