Skip to content

Commit 24dd3da

Browse files
authored
Revert "added hint for multiline triple backtick code block detector (#3327)" (#3439)
This reverts commit 2d16273.
1 parent 0bc464e commit 24dd3da

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

crates/chat-cli/src/cli/chat/prompt.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -353,16 +353,6 @@ impl ChatHinter {
353353
return None;
354354
}
355355

356-
// Check for unclosed triple backticks
357-
if line.contains("```") {
358-
let triple_backtick_count = line.matches("```").count();
359-
if triple_backtick_count % 2 == 1 {
360-
// We have an odd number of ```, meaning we're in multiline mode
361-
// Show status hint (right arrow key is overridden to not complete this)
362-
return Some("in multiline mode, waiting for closing backticks ```".to_string());
363-
}
364-
}
365-
366356
// If line starts with a slash, try to find a command hint
367357
if line.starts_with('/') {
368358
return self
@@ -560,34 +550,6 @@ impl rustyline::ConditionalEventHandler for PasteImageHandler {
560550
}
561551
}
562552

563-
/// Handler for right arrow key that prevents completing the multiline status hint
564-
struct RightArrowHandler;
565-
566-
impl rustyline::ConditionalEventHandler for RightArrowHandler {
567-
fn handle(
568-
&self,
569-
_evt: &rustyline::Event,
570-
_n: rustyline::RepeatCount,
571-
_positive: bool,
572-
ctx: &rustyline::EventContext<'_>,
573-
) -> Option<Cmd> {
574-
let line = ctx.line();
575-
576-
// Check if we're in multiline mode with unclosed backticks
577-
if line.contains("```") {
578-
let triple_backtick_count = line.matches("```").count();
579-
if triple_backtick_count % 2 == 1 {
580-
// We're in multiline mode - don't complete the hint
581-
// Just move the cursor forward instead
582-
return Some(Cmd::Move(rustyline::Movement::ForwardChar(1)));
583-
}
584-
}
585-
586-
// Normal case - complete the hint
587-
Some(Cmd::CompleteHint)
588-
}
589-
}
590-
591553
pub fn rl(
592554
os: &Os,
593555
sender: PromptQuerySender,
@@ -681,12 +643,6 @@ pub fn rl(
681643
EventHandler::Conditional(Box::new(PasteImageHandler::new(paste_state))),
682644
);
683645

684-
// Override right arrow key to prevent completing multiline status hints
685-
rl.bind_sequence(
686-
KeyEvent(KeyCode::Right, Modifiers::empty()),
687-
EventHandler::Conditional(Box::new(RightArrowHandler)),
688-
);
689-
690646
Ok(rl)
691647
}
692648

0 commit comments

Comments
 (0)