diff --git a/src/reader.cpp b/src/reader.cpp index 6477f7a9e..b5bc3c3c1 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1093,8 +1093,8 @@ void reader_data_t::paint_layout(const wchar_t *reason) { // Prepend the mode prompt to the left prompt. screen.write(mode_prompt_buff + left_prompt_buff, right_prompt_buff, full_line, - cmd_line->size(), colors, indents, data.position, pager, current_page_rendering, - data.focused_on_pager); + cmd_line->size(), colors, indents, data.position, parser().vars(), pager, + current_page_rendering, data.focused_on_pager); } /// Internal helper function for handling killing parts of text. diff --git a/src/screen.cpp b/src/screen.cpp index 77861e808..493a3c75d 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -717,10 +717,8 @@ bool screen_t::handle_soft_wrap(int x, int y) { } /// Update the screen to match the desired output. -void screen_t::update(const wcstring &left_prompt, const wcstring &right_prompt) { - // TODO: this should be passed in. - const environment_t &vars = env_stack_t::principal(); - +void screen_t::update(const wcstring &left_prompt, const wcstring &right_prompt, + const environment_t &vars) { // Helper function to set a resolved color, using the caching resolver. highlight_color_resolver_t color_resolver{}; auto set_color = [&](highlight_spec_t c) { @@ -1145,8 +1143,8 @@ static screen_layout_t compute_layout(screen_t *s, size_t screen_width, void screen_t::write(const wcstring &left_prompt, const wcstring &right_prompt, const wcstring &commandline, size_t explicit_len, const std::vector &colors, const std::vector &indent, - size_t cursor_pos, pager_t &pager, page_rendering_t &page_rendering, - bool cursor_is_within_pager) { + size_t cursor_pos, const environment_t &vars, pager_t &pager, + page_rendering_t &page_rendering, bool cursor_is_within_pager) { termsize_t curr_termsize = termsize_last(); int screen_width = curr_termsize.width; static relaxed_atomic_t s_repaints{0}; @@ -1236,7 +1234,7 @@ void screen_t::write(const wcstring &left_prompt, const wcstring &right_prompt, // Append pager_data (none if empty). this->desired.append_lines(page_rendering.screen_data); - this->update(layout.left_prompt, layout.right_prompt); + this->update(layout.left_prompt, layout.right_prompt, vars); this->save_status(); } diff --git a/src/screen.h b/src/screen.h index 28278323c..6243b2d5b 100644 --- a/src/screen.h +++ b/src/screen.h @@ -151,8 +151,8 @@ class screen_t { void write(const wcstring &left_prompt, const wcstring &right_prompt, const wcstring &commandline, size_t explicit_len, const std::vector &colors, const std::vector &indent, - size_t cursor_pos, pager_t &pager, page_rendering_t &page_rendering, - bool cursor_is_within_pager); + size_t cursor_pos, const environment_t &vars, pager_t &pager, + page_rendering_t &page_rendering, bool cursor_is_within_pager); /// Resets the screen buffer's internal knowledge about the contents of the screen, /// optionally repainting the prompt as well. @@ -236,7 +236,8 @@ class screen_t { outputter_t &outp() { return outp_; } /// Update the screen to match the desired output. - void update(const wcstring &left_prompt, const wcstring &right_prompt); + void update(const wcstring &left_prompt, const wcstring &right_prompt, + const environment_t &vars); class scoped_buffer_t; };