aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/asset/comp
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-04-11 18:29:57 +0800
committer魏曹先生 <1992414357@qq.com>2026-04-11 18:29:57 +0800
commit1eb5306fe6e0e09970b37d267051589d8133a824 (patch)
tree67dc49cd20ec213ed674e877268cd69633e68690 /mingling_core/src/asset/comp
parent0b9d890fd9764fa3ec0b749f4b15610e49e3cb8d (diff)
Implement basic command completion with shell support
Diffstat (limited to 'mingling_core/src/asset/comp')
-rw-r--r--mingling_core/src/asset/comp/shell_ctx.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/mingling_core/src/asset/comp/shell_ctx.rs b/mingling_core/src/asset/comp/shell_ctx.rs
index 4771e63..5ab0514 100644
--- a/mingling_core/src/asset/comp/shell_ctx.rs
+++ b/mingling_core/src/asset/comp/shell_ctx.rs
@@ -74,22 +74,17 @@ impl TryFrom<Vec<String>> for ShellContext {
.map(ShellFlag::from)
.unwrap_or(ShellFlag::Other("unknown".to_string()));
- // Build all_words from command_line using basic whitespace splitting
- // Note: External input replaces '-' with '^' in arguments, so we need to restore them
let all_words = command_line
.split_whitespace()
.map(|s| s.replace('^', "-"))
.collect();
- // Also restore the original command_line with proper hyphens
- let command_line = command_line.replace('^', "-");
-
Ok(ShellContext {
- command_line,
+ command_line: command_line.replace('^', "-"),
cursor_position,
- current_word,
- previous_word,
- command_name,
+ current_word: current_word.replace('^', "-"),
+ previous_word: previous_word.replace('^', "-"),
+ command_name: command_name.replace('^', "-"),
word_index,
all_words,
shell_flag,