Repository: ynqa/promkit (language: rust)

Issue:
History doesn't seem to work for Readline
## Description
Using the arrows to navigate history doesn't work.

## Reproduction
```rs
use promkit::{preset::readline::Readline, suggest::Suggest};

fn main() -> anyhow::Result<()> {
    let mut p = Readline::default()
        .enable_history()
        .enable_suggest(Suggest::from_iter([
            "apple",
            "applet",
            "application",
            "banana",
        ]))
        .prompt()?;
    loop {
        match p.run() {
            Ok(cmd) => {
                println!("result: {:?}", cmd);
            }
            Err(_) => {
                println!("Bye!");
                break;
            }
        }
    }
    Ok(())
}
```

# Additional Info

When I try to log the history, it seems like the `contents` section is empty and doesn't get added to.
I tried adding the text entry manually to the history:
```rs
use promkit::{preset::readline::Readline, suggest::Suggest};

fn main() -> anyhow::Result<()> {
    let mut p = Readline::default()
        .enable_history()
        .enable_suggest(Suggest::from_iter([
            "apple",
            "applet",
            "application",
            "banana",
        ]))
        .prompt()?;
    loop {
        match p.run() {
            Ok(cmd) => {
                println!("result: {:?}", cmd);
                p.renderer
                    .text_editor_snapshot
                    .after_mut()
                    .history
                    .as_mut()
                    .unwrap()
                    .insert(cmd);
            }
            Err(_) => {
                println!("Bye!");
                break;
            }
        }
    }
    Ok(())
}
```
This worked for a single entry (I could press the up arrow once to get the previous command) but I couldn't go any further



Discussion / hints:

Fix patch:
diff --git a/promkit/src/preset/readline/render.rs b/promkit/src/preset/readline/render.rs
index b00da219..1b7563a8 100644
--- a/promkit/src/preset/readline/render.rs
+++ b/promkit/src/preset/readline/render.rs
@@ -37,7 +37,12 @@ impl crate::Finalizer for Renderer {
             .texteditor
             .text_without_cursor()
             .to_string();
+
+        // Keep history over state reset
+        let history = self.text_editor_snapshot.after_mut().history.take();
         self.text_editor_snapshot.reset_after_to_init();
+        self.text_editor_snapshot.after_mut().history = history;
+
         Ok(ret)
     }
 }


Test patch: