mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-23 14:53:00 +08:00
Thread the right PWD through autosuggestions
These were getting / as the PWD, resulting in bogus suggestions.
This commit is contained in:
parent
455959ae7a
commit
59d62fdd53
|
@ -1657,11 +1657,11 @@ maybe_t<env_var_t> env_vars_snapshot_t::get(const wcstring &key, env_mode_flags_
|
||||||
|
|
||||||
wcstring_list_t env_vars_snapshot_t::get_names(int flags) const { return names; }
|
wcstring_list_t env_vars_snapshot_t::get_names(int flags) const { return names; }
|
||||||
|
|
||||||
const wchar_t *const env_vars_snapshot_t::highlighting_keys[] = {L"PATH", L"CDPATH",
|
const wchar_t *const env_vars_snapshot_t::highlighting_keys[] = {
|
||||||
L"fish_function_path", NULL};
|
L"PATH", L"CDPATH", L"fish_function_path", L"PWD", NULL};
|
||||||
|
|
||||||
const wchar_t *const env_vars_snapshot_t::completing_keys[] = {L"PATH", L"CDPATH",
|
const wchar_t *const env_vars_snapshot_t::completing_keys[] = {L"PATH", L"CDPATH",
|
||||||
L"fish_function_path", NULL};
|
L"fish_function_path", L"PWD", NULL};
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(__CYGWIN__)
|
#if defined(__APPLE__) || defined(__CYGWIN__)
|
||||||
static int check_runtime_path(const char *path) {
|
static int check_runtime_path(const char *path) {
|
||||||
|
|
|
@ -1292,13 +1292,14 @@ static std::function<autosuggestion_result_t(void)> get_autosuggestion_performer
|
||||||
const auto &parser_vars = parser_t::principal_parser().vars();
|
const auto &parser_vars = parser_t::principal_parser().vars();
|
||||||
const unsigned int generation_count = read_generation_count();
|
const unsigned int generation_count = read_generation_count();
|
||||||
const wcstring working_directory = parser_vars.get_pwd_slash();
|
const wcstring working_directory = parser_vars.get_pwd_slash();
|
||||||
env_vars_snapshot_t vars(vars, env_vars_snapshot_t::highlighting_keys);
|
env_vars_snapshot_t vars(parser_vars, env_vars_snapshot_t::completing_keys);
|
||||||
// TODO: suspicious use of 'history' here
|
// TODO: suspicious use of 'history' here
|
||||||
// This is safe because histories are immortal, but perhaps
|
// This is safe because histories are immortal, but perhaps
|
||||||
// this should use shared_ptr
|
// this should use shared_ptr
|
||||||
return [=]() -> autosuggestion_result_t {
|
return [=]() -> autosuggestion_result_t {
|
||||||
ASSERT_IS_BACKGROUND_THREAD();
|
ASSERT_IS_BACKGROUND_THREAD();
|
||||||
|
|
||||||
|
|
||||||
const autosuggestion_result_t nothing = {};
|
const autosuggestion_result_t nothing = {};
|
||||||
// If the main thread has moved on, skip all the work.
|
// If the main thread has moved on, skip all the work.
|
||||||
if (generation_count != read_generation_count()) {
|
if (generation_count != read_generation_count()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user