Merge pull request #2431 from reidliu41/fix/attach-absolute-path-completion
fix(tui): suppress inline skill completions in slash command args
This commit is contained in:
@@ -87,6 +87,10 @@ pub(crate) fn partial_inline_skill_mention_at_cursor(
|
||||
input: &str,
|
||||
cursor_chars: usize,
|
||||
) -> Option<(usize, String)> {
|
||||
if looks_like_slash_command_input(input) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let chars: Vec<char> = input.chars().collect();
|
||||
if cursor_chars > chars.len() {
|
||||
return None;
|
||||
|
||||
@@ -3536,6 +3536,28 @@ fn inline_skill_slash_popup_filters_partial_without_leaking_to_command_position(
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inline_skill_slash_popup_does_not_open_inside_command_arguments() {
|
||||
let mut app = create_test_app();
|
||||
app.cached_skills = vec![
|
||||
(
|
||||
"config-doctor".to_string(),
|
||||
"Diagnose configuration".to_string(),
|
||||
),
|
||||
("cargo-ci-fixer".to_string(), "Fix CI failures".to_string()),
|
||||
];
|
||||
app.input = "/attach /".to_string();
|
||||
app.cursor_position = app.input.chars().count();
|
||||
|
||||
let entries = visible_slash_menu_entries(&app, 128);
|
||||
|
||||
assert!(
|
||||
entries.is_empty(),
|
||||
"command argument paths should not show inline skill entries: {:?}",
|
||||
entries.iter().map(|entry| &entry.name).collect::<Vec<_>>()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn apply_slash_menu_selection_splices_inline_skill_mention() {
|
||||
let mut app = create_test_app();
|
||||
|
||||
Reference in New Issue
Block a user