diff --git a/src/reader.cpp b/src/reader.cpp index 724998c65..b29fec63d 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -638,8 +638,8 @@ void reader_data_t::repaint() { bool focused_on_pager = active_edit_line() == &pager.search_field_line; size_t cursor_position = focused_on_pager ? pager.cursor_position() : cmd_line->position; - s_write(&screen, left_prompt_buff, right_prompt_buff, full_line, cmd_line->size(), &colors[0], - &indents[0], cursor_position, current_page_rendering, focused_on_pager); + s_write(&screen, left_prompt_buff, right_prompt_buff, full_line, cmd_line->size(), colors, + indents, cursor_position, current_page_rendering, focused_on_pager); repaint_needed = false; } diff --git a/src/screen.cpp b/src/screen.cpp index c3cb517b5..560868739 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -802,7 +802,8 @@ static size_t truncation_offset_for_width(const std::vector &width_by_of static screen_layout_t compute_layout(screen_t *s, size_t screen_width, const wcstring &left_prompt_str, const wcstring &right_prompt_str, const wcstring &commandline, - const wcstring &autosuggestion_str, const int *indent) { + const wcstring &autosuggestion_str, + const std::vector &indent) { UNUSED(s); screen_layout_t result = {}; @@ -847,7 +848,7 @@ static screen_layout_t compute_layout(screen_t *s, size_t screen_width, if (c == L'\n') { // Make a new line. command_lines.push_back(wcstring()); - line_widths.push_back(indent[i] * INDENT_STEP); + line_widths.push_back(indent.at(i) * INDENT_STEP); } else { command_lines.back() += c; line_widths.back() += fish_wcwidth_min_0(c); @@ -951,12 +952,10 @@ static screen_layout_t compute_layout(screen_t *s, size_t screen_width, } void s_write(screen_t *s, const wcstring &left_prompt, const wcstring &right_prompt, - const wcstring &commandline, size_t explicit_len, const highlight_spec_t *colors, - const int *indent, size_t cursor_pos, const page_rendering_t &pager, - bool cursor_is_within_pager) { + const wcstring &commandline, size_t explicit_len, + const std::vector &colors, const std::vector &indent, + size_t cursor_pos, const page_rendering_t &pager, bool cursor_is_within_pager) { screen_data_t::cursor_t cursor_arr; - CHECK(s, ); - CHECK(indent, ); // Turn the command line into the explicit portion and the autosuggestion. const wcstring explicit_command_line = commandline.substr(0, explicit_len); diff --git a/src/screen.h b/src/screen.h index 01b3266f8..3a0afba73 100644 --- a/src/screen.h +++ b/src/screen.h @@ -169,9 +169,9 @@ class screen_t { /// \param pager_data any pager data, to append to the screen /// \param cursor_is_within_pager whether the position is within the pager line (first line) void s_write(screen_t *s, const wcstring &left_prompt, const wcstring &right_prompt, - const wcstring &commandline, size_t explicit_len, const highlight_spec_t *colors, - const int *indent, size_t cursor_pos, const page_rendering_t &pager_data, - bool cursor_is_within_pager); + const wcstring &commandline, size_t explicit_len, + const std::vector &colors, const std::vector &indent, + size_t cursor_pos, const page_rendering_t &pager_data, bool cursor_is_within_pager); /// This function resets the screen buffers internal knowledge about the contents of the screen. Use /// this function when some other function than s_write has written to the screen.