diff --git a/crates/goose-cli/src/prompt/rustyline.rs b/crates/goose-cli/src/prompt/rustyline.rs index c80bcac06427..48cf371c5a82 100644 --- a/crates/goose-cli/src/prompt/rustyline.rs +++ b/crates/goose-cli/src/prompt/rustyline.rs @@ -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"; @@ -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(), @@ -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,