Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions crates/goose-cli/src/prompt/rustyline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::{
use anyhow::Result;
use cliclack::spinner;
use goose::message::Message;
use rustyline::DefaultEditor;
use rustyline::{DefaultEditor, EventHandler, KeyCode, KeyEvent, Modifiers};

const PROMPT: &str = "\x1b[1m\x1b[38;5;30m( O)> \x1b[0m";

Expand All @@ -31,7 +31,11 @@ impl RustylinePrompt {
Box::new(bash_dev_system_renderer),
);

let editor = DefaultEditor::new().expect("Failed to create editor");
let mut editor = DefaultEditor::new().expect("Failed to create editor");
editor.bind_sequence(
KeyEvent(KeyCode::Char('j'), Modifiers::CTRL),
EventHandler::Simple(rustyline::Cmd::Newline),
);

RustylinePrompt {
spinner: spinner(),
Expand Down Expand Up @@ -118,6 +122,7 @@ impl Prompt for RustylinePrompt {
println!("/t - Toggle Light/Dark theme");
println!("/? | /help - Display this help message");
println!("Ctrl+C - Interrupt goose (resets the interaction to before the interrupted user request)");
println!("Ctrl+j - Adds a newline");
println!("Use Up/Down arrow keys to navigate through command history");
return Ok(Input {
input_type: InputType::AskAgain,
Expand Down
Loading