From 701ca5365d4f903fa69cc467e4b5bad455780c5b Mon Sep 17 00:00:00 2001
From: gwenn <gtreguier@gmail.com>
Date: Sun, 20 May 2018 16:32:03 +0200
Subject: [PATCH] Update docs

---
 README.md  | 30 +++++++++++++++---------------
 TODO.md    |  4 ++++
 src/lib.rs |  3 +++
 3 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md
index 33826e36..83e97ce6 100644
--- a/README.md
+++ b/README.md
@@ -27,14 +27,14 @@ use rustyline::Editor;
 fn main() {
     // `()` can be used when no completer is required
     let mut rl = Editor::<()>::new();
-    if let Err(_) = rl.load_history("history.txt") {
+    if rl.load_history("history.txt").is_err() {
         println!("No previous history.");
     }
     loop {
         let readline = rl.readline(">> ");
         match readline {
             Ok(line) => {
-                rl.add_history_entry(&line);
+                rl.add_history_entry(line.as_ref());
                 println!("Line: {}", line);
             },
             Err(ReadlineError::Interrupted) => {
@@ -73,7 +73,7 @@ rustyline = "1.0.0"
  - Kill ring ([Killing Commands](http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#IDX3))
  - Multi line mode (line wrapping)
  - Word commands
- - Hints (WIP: only on unix)
+ - Hints
 
 ## Actions
 
@@ -94,7 +94,6 @@ Ctrl-T       | Transpose previous character with current character
 Ctrl-U       | Delete from start of line to cursor
 Ctrl-V       | Insert any special character without perfoming its associated action (#65)
 Ctrl-W       | Delete word leading up to cursor (using white space as a word boundary)
-Ctrl-X Ctrl-U | Undo
 Ctrl-Y       | Paste from Yank buffer
 Ctrl-Z       | Suspend (unix only)
 Ctrl-_       | Undo
@@ -113,6 +112,7 @@ Ctrl-K       | Delete from cursor to end of line
 Ctrl-L       | Clear screen
 Ctrl-N, Down | Next match from history
 Ctrl-P, Up   | Previous match from history
+Ctrl-X Ctrl-U | Undo
 Ctrl-Y       | Paste from Yank buffer (Meta-Y to paste next yank instead)
 Meta-<       | Move to first entry in history
 Meta->       | Move to last entry in history
@@ -205,17 +205,17 @@ $ bind -p
 
 ## Similar projects
 
-Library            | Lang    | OS     | Term  | Unicode | History       | Completion | Keymap        | Kill Ring | Undo | Colors     |
---------           | ----    | --     | ----  | ------- | -------       | ---------- | -------       | --------- | ---- | ------     |
-[Haskeline][]      | Haskell | Ux/Win | Any   | Yes     | Yes           | any        | Emacs/Vi/conf | Yes       | Yes  | ?          |
-[Linenoise][]      | C       | Ux     | ANSI  | No      | Yes           | only line  | Emacs         | No        | No   | Ux         |
-[Linenoise-ng][]   | C       | Ux/Win | ANSI  | Yes     | Yes           | only line  | Emacs         | Yes       | No   | ?          |
-[Linefeed][]       | Rust    | Ux/Win | Any   |         | Yes           | any        | Emacs/conf    | Yes       | No   | ?          |
-[Liner][]          | Rust    | Ux     | ANSI  |         | No inc search | only word  | Emacs/Vi      | No        | Yes  | Ux         |
-[Prompt-toolkit][] | Python  | Ux/Win | ANSI  | Yes     | Yes           | any        | Emacs/Vi/conf | Yes       | Yes  | Ux/Win     |
-[Rb-readline][]    | Ruby    | Ux/Win | ANSI  | Yes     | Yes           | only word  | Emacs/Vi/conf | Yes       | Yes  | ?          |
-[Replxx][]         | C/C++   | Ux/Win | ANSI  | Yes     | Yes           | only line  | Emacs         | Yes       | No   | Ux/Win     |
-Rustyline          | Rust    | Ux/Win | ANSI  | Yes     | Yes           | any        | Emacs/Vi/bind | Yes       | Yes  | Ux/Win 10+ |
+Library            | Lang    | OS     | Term  | Unicode | History       | Completion | Keymap        | Kill Ring | Undo | Colors     | Hint/Auto suggest |
+--------           | ----    | --     | ----  | ------- | -------       | ---------- | -------       | --------- | ---- | ------     | ----------------- |
+[Haskeline][]      | Haskell | Ux/Win | Any   | Yes     | Yes           | any        | Emacs/Vi/conf | Yes       | Yes  | ?          | ?                 |
+[Linenoise][]      | C       | Ux     | ANSI  | No      | Yes           | only line  | Emacs         | No        | No   | Ux         | Yes               |
+[Linenoise-ng][]   | C       | Ux/Win | ANSI  | Yes     | Yes           | only line  | Emacs         | Yes       | No   | ?          | ?                 |
+[Linefeed][]       | Rust    | Ux/Win | Any   |         | Yes           | any        | Emacs/conf    | Yes       | No   | ?          | No                |
+[Liner][]          | Rust    | Ux     | ANSI  |         | No inc search | only word  | Emacs/Vi/prog | No        | Yes  | Ux         | History based     |
+[Prompt-toolkit][] | Python  | Ux/Win | ANSI  | Yes     | Yes           | any        | Emacs/Vi/conf | Yes       | Yes  | Ux/Win     | Yes               |
+[Rb-readline][]    | Ruby    | Ux/Win | ANSI  | Yes     | Yes           | only word  | Emacs/Vi/conf | Yes       | Yes  | ?          | No                |
+[Replxx][]         | C/C++   | Ux/Win | ANSI  | Yes     | Yes           | only line  | Emacs         | Yes       | No   | Ux/Win     | Yes               |
+Rustyline          | Rust    | Ux/Win | ANSI  | Yes     | Yes           | any        | Emacs/Vi/bind | Yes       | Yes  | Ux/Win 10+ | Yes               |
 
 [Haskeline]: https://github.com/judah/haskeline
 [Linefeed]: https://github.com/murarth/linefeed
diff --git a/TODO.md b/TODO.md
index 50efdb42..5c835230 100644
--- a/TODO.md
+++ b/TODO.md
@@ -58,6 +58,10 @@ Repeat
 - [x] dynamic prompt (arg: ?)
 - [ ] transpose chars
 
+Syntax
+- [ ] syntax specific tokenizer/parser
+- [ ] highlighting
+
 Undo
 - [ ] Merge consecutive Replace
 - [X] Undo group
diff --git a/src/lib.rs b/src/lib.rs
index 903fbaa8..8f8a061c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -606,6 +606,9 @@ fn readline_direct() -> Result<String> {
     }
 }
 
+/// Syntax specific helper.
+///
+/// TODO Tokenizer/parser used for both completion, suggestion, highlighting
 pub trait Helper {
     type Completer: Completer;
     type Hinter: Hinter;
-- 
GitLab