reader: use simpler test environment constructor

A following commit wants to pass parser by exclusive reference,
which disallows passing "parser" as well as "parser.vars()"
in one function call.  This use case also doesn't make sense.
The "OperationContext::test_only_foreground" constructor is used to
inject a special "PwdEnvironment" into the context.  When we don't need
this environment, we can use a regular constructor, which already uses
"parser.vars()".
This commit is contained in:
Johannes Altmanninger
2026-04-29 14:37:43 +08:00
parent 12fa0d8b3d
commit 398fc17b81

View File

@@ -7302,10 +7302,10 @@ macro_rules! validate {
let mut cursor_pos = in_cursor_pos;
let result = completion_apply_to_command_line(
&OperationContext::test_only_foreground(
&OperationContext::foreground(
&parser,
parser.vars(),
Box::new(no_cancel),
crate::operation_context::EXPANSION_LIMIT_DEFAULT,
),
completion,
$flags,