mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 15:19:11 +08:00
Prefix history pager results with a fake prompt
This makes it easy to see where the individual commands start. Perhaps we can get rid of this once we have syntax highlighting for the commands in the history pager, or if we add timestamps as descriptions.
This commit is contained in:
parent
453aac14af
commit
1af9b8e430
@ -153,7 +153,10 @@ line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, s
|
||||
|
||||
highlight_role_t bg_role = modify_role(highlight_role_t::pager_background);
|
||||
highlight_spec_t bg = {highlight_role_t::normal, bg_role};
|
||||
highlight_spec_t prefix_col = {modify_role(highlight_role_t::pager_prefix), bg_role};
|
||||
highlight_spec_t prefix_col = {
|
||||
modify_role(highlight_prefix ? highlight_role_t::pager_prefix
|
||||
: highlight_role_t::pager_completion),
|
||||
bg_role};
|
||||
highlight_spec_t comp_col = {modify_role(highlight_role_t::pager_completion), bg_role};
|
||||
highlight_spec_t desc_col = {modify_role(highlight_role_t::pager_description), bg_role};
|
||||
|
||||
@ -392,7 +395,10 @@ void pager_t::set_completions(const completion_list_t &raw_completions) {
|
||||
have_unrendered_completions = true;
|
||||
}
|
||||
|
||||
void pager_t::set_prefix(const wcstring &pref) { prefix = pref; }
|
||||
void pager_t::set_prefix(const wcstring &pref, bool highlight) {
|
||||
prefix = pref;
|
||||
highlight_prefix = highlight;
|
||||
}
|
||||
|
||||
void pager_t::set_term_size(termsize_t ts) {
|
||||
available_term_width = ts.width > 0 ? ts.width : 0;
|
||||
@ -858,6 +864,7 @@ void pager_t::clear() {
|
||||
unfiltered_completion_infos.clear();
|
||||
completion_infos.clear();
|
||||
prefix.clear();
|
||||
highlight_prefix = false;
|
||||
selected_completion_idx = PAGER_SELECTION_NONE;
|
||||
fully_disclosed = false;
|
||||
search_field_shown = false;
|
||||
|
@ -121,6 +121,7 @@ class pager_t {
|
||||
bool have_unrendered_completions = false;
|
||||
|
||||
wcstring prefix;
|
||||
bool highlight_prefix = false;
|
||||
|
||||
bool completion_try_print(size_t cols, const wcstring &prefix, const comp_info_list_t &lst,
|
||||
page_rendering_t *rendering, size_t suggested_start_row) const;
|
||||
@ -145,7 +146,7 @@ class pager_t {
|
||||
void set_completions(const completion_list_t &raw_completions);
|
||||
|
||||
// Sets the prefix.
|
||||
void set_prefix(const wcstring &pref);
|
||||
void set_prefix(const wcstring &pref, bool highlight = true);
|
||||
|
||||
// Sets the terminal size.
|
||||
void set_term_size(termsize_t ts);
|
||||
|
@ -3754,7 +3754,7 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
|
||||
this->history_pager_history_index_end = 0;
|
||||
// Update the pager data.
|
||||
pager.set_search_field_shown(true);
|
||||
pager.set_prefix(L"");
|
||||
pager.set_prefix(MB_CUR_MAX > 1 ? L"► " : L"> ", false /* highlight */);
|
||||
// Update the search field, which triggers the actual history search.
|
||||
insert_string(&pager.search_field_line, command_line.text());
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user