mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-20 14:11:14 -03:00
Allow specifying a limit on number of expansion in operation_context
If the user types something like `/**`, prior to this change we would attempt to expand it in the background for both highlighting and autosuggestions. This could thrash your disk and also consume a lot of memory. Add a a field to operation_context_t to allow specifying a limit, and add a "default background" limit of 512 items.
This commit is contained in:
@@ -8,8 +8,12 @@
|
||||
bool no_cancel() { return false; }
|
||||
|
||||
operation_context_t::operation_context_t(std::shared_ptr<parser_t> parser,
|
||||
const environment_t &vars, cancel_checker_t cancel_checker)
|
||||
: parser(std::move(parser)), vars(vars), cancel_checker(std::move(cancel_checker)) {}
|
||||
const environment_t &vars, cancel_checker_t cancel_checker,
|
||||
size_t expansion_limit)
|
||||
: parser(std::move(parser)),
|
||||
vars(vars),
|
||||
expansion_limit(expansion_limit),
|
||||
cancel_checker(std::move(cancel_checker)) {}
|
||||
|
||||
operation_context_t operation_context_t::empty() {
|
||||
static const null_environment_t nullenv{};
|
||||
|
||||
Reference in New Issue
Block a user