mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-11-06 16:15:41 +00:00
fix(terminal): leave Copilot's file list behind before pressing Enter
With the caret at the end of an `@` word Copilot lists matching files, and Enter takes the list's pick instead of sending, so a message that closed on a mention (one picked from the composer's own `@` menu ends that way) sat in Copilot's input unsent. End such a message with a space, as for Gemini.
This commit is contained in:
@@ -149,8 +149,8 @@ pub(super) struct Step {
|
||||
/// box as a key of its own; arriving with the rest of the line it is just a
|
||||
/// character. (Amp's shell mode is a leading `$`, which it reads off a paste
|
||||
/// as well.)
|
||||
/// - **A message with an `@` mention gets a space after it for Gemini and
|
||||
/// Qwen Code.**
|
||||
/// - **A message with an `@` mention gets a space after it for Gemini, Qwen
|
||||
/// Code and Copilot.**
|
||||
/// With the caret at the end of an `@` word it lists matching files, and
|
||||
/// Enter then takes the list's pick instead of sending — so a message whose
|
||||
/// attachments close it would sit in the input, under the box, unsent.
|
||||
@@ -185,7 +185,10 @@ pub(super) fn submit_plan(agent: CLIAgent, text: &str, bracketed: bool) -> Vec<S
|
||||
// Where the last word starts is a matter of Gemini's escaping and quoting,
|
||||
// so any `@` will do: a space after the message costs nothing. Not after a
|
||||
// command, though, where it would open the list of its arguments.
|
||||
if reads_like_gemini(agent) && body.contains('@') && !body.starts_with('/') {
|
||||
if (reads_like_gemini(agent) || agent == CLIAgent::Copilot)
|
||||
&& body.contains('@')
|
||||
&& !body.starts_with('/')
|
||||
{
|
||||
spaced = format!("{body} ");
|
||||
body = &spaced;
|
||||
}
|
||||
@@ -2458,6 +2461,9 @@ mod tests {
|
||||
assert_eq!(bytes(&steps), [&b"/memory"[..], b"\r"]);
|
||||
let steps = submit_plan(CLIAgent::Claude, "read @a.rs", true);
|
||||
assert_eq!(bytes(&steps), [&b"read @a.rs"[..], b"\r"]);
|
||||
// Copilot's list takes that Enter as well.
|
||||
let steps = submit_plan(CLIAgent::Copilot, "read @a.rs", false);
|
||||
assert_eq!(bytes(&steps), [&b"read @a.rs "[..], b"\r"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user