Repository: kkawakam/rustyline (rust)

Issue:
Crash at rustyline-11.0.0/src/keymap.rs:205:18
Hi, 

when I have rustyline configured the following way:


```
 let config_builder = rustyline::config::Config::builder()
  .max_history_size(10000)?
  .history_ignore_dups( true)?
  .auto_add_history(true)
  .bell_style(rustyline::config::BellStyle::None)
  .completion_type(rustyline::config::CompletionType::List)
  .edit_mode( rustyline::EditMode::Vi);

 let config = config_builder.build();

```

(note that vi mode is active)

Later on I am in the commandline via:

`rl.readline(">> ");`

And I press 'ESC' (so I am in the command mode of the vi mode)
and then I press '.' then it crashes.

`>> thread 'main' panicked at 'internal error: entered unreachable code', .../.cargo/registry/src/github.com-1ecc6299db9ec823/rustyline-11.0.0/src/keymap.rs:205:18`

'.' in the vi mode is the repetition of the latest command but in this situation there was no latest command yet.

Regards,
Frank Schwidom



Pull request description:
Fix dot command in vi mode
Fix #705

Patch:
diff --git a/src/keymap.rs b/src/keymap.rs
index 025ea97..20ab049 100644
--- a/src/keymap.rs
+++ b/src/keymap.rs
@@ -711,7 +711,9 @@ impl<'b> InputState<'b> {
             E(K::Char('$') | K::End, M::NONE) => Cmd::Move(Movement::EndOfLine),
             E(K::Char('.'), M::NONE) => {
                 // vi-redo (repeat last command)
-                if no_num_args {
+                if !self.last_cmd.is_repeatable() {
+                    Cmd::Noop
+                } else if no_num_args {
                     self.last_cmd.redo(None, wrt)
                 } else {
                     self.last_cmd.redo(Some(n), wrt)


Test patch:
diff --git a/src/test/vi_cmd.rs b/src/test/vi_cmd.rs
index c8ff89b..9971562 100644
--- a/src/test/vi_cmd.rs
+++ b/src/test/vi_cmd.rs
@@ -13,10 +13,15 @@ fn dollar() {
     );
 }
 
-/*#[test]
+#[test]
 fn dot() {
-    // TODO
-}*/
+    assert_cursor(
+        EditMode::Vi,
+        ("", ""),
+        &[E::ESC, E::from('.'), E::ENTER],
+        ("", ""),
+    );
+}
 
 #[test]
 fn semi_colon() {