akinomyoga / ble.sh

Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions.
BSD 3-Clause "New" or "Revised" License
2.64k stars 83 forks source link

how to change the style of the filtered prefix in the autocomplete menu? #519

Open simonLeary42 opened 1 week ago

simonLeary42 commented 1 week ago

image

it's shown as bold, but I'd like it to pop a bit more. Looking around ble-face I saw that there is a highlight on the input line called menu_filter_input, and I saw that menu_filter_fixed was equal to bold. But then I changed menu_filter_fixed and nothing happened. No other style in ble-face uses bold.

simonLeary42 commented 1 week ago

here's my theme:

image

``` ble-face argument_error=fg=203,underline ble-face argument_option=none ble-face auto_complete=fg=238,bg=254 ble-face cmdinfo_cd_cdpath=fg=26,bg=155 ble-face command_alias=fg=187 ble-face command_builtin=fg=170 ble-face command_builtin_dot=fg=170 ble-face command_directory=none ble-face command_file=fg=43 ble-face command_function=fg=187 ble-face command_jobs=fg=170 ble-face command_keyword=fg=75 ble-face command_suffix=fg=231,bg=28 ble-face command_suffix_new=fg=231,bg=124 ble-face disabled=fg=242 ble-face filename_block=fg=yellow,bg=black,underline ble-face filename_character=fg=231,bg=black,underline ble-face filename_directory=fg=33,underline ble-face filename_directory_sticky=fg=231,bg=26,underline ble-face filename_executable=fg=green,underline ble-face filename_link=fg=teal,underline ble-face filename_ls_colors=none ble-face filename_orphan=fg=16,bg=224,underline ble-face filename_other=underline ble-face filename_pipe=fg=lime,bg=black,underline ble-face filename_setgid=fg=black,bg=191,underline ble-face filename_setuid=fg=black,bg=220,underline ble-face filename_socket=fg=cyan,bg=black,underline ble-face filename_url=fg=blue,underline ble-face filename_warning=fg=red,underline ble-face menu_desc_default=none ble-face menu_desc_quote=ref:syntax_quoted ble-face menu_desc_type=ref:syntax_delimiter ble-face menu_filter_fixed=reverse ble-face menu_filter_input=fg=16,bg=229 ble-face overwrite_mode=fg=black,bg=51 ble-face prompt_status_line=fg=231,bg=240 ble-face region=fg=231,bg=60 ble-face region_insert=fg=27,bg=254 ble-face region_match=fg=231,bg=55 ble-face region_target=fg=black,bg=153 ble-face syntax_brace=fg=187 ble-face syntax_command=none ble-face syntax_comment=fg=65 ble-face syntax_default=none ble-face syntax_delimiter=none ble-face syntax_document=fg=100 ble-face syntax_document_begin=fg=100,bold ble-face syntax_error=fg=203,underline ble-face syntax_escape=fg=magenta ble-face syntax_expr=none ble-face syntax_function_name=fg=170 ble-face syntax_glob=fg=170 ble-face syntax_history_expansion=fg=231,bg=94 ble-face syntax_param_expansion=none ble-face syntax_quotation=fg=173,bg=240 ble-face syntax_quoted=fg=173 ble-face syntax_tilde=fg=170 ble-face syntax_varname=fg=117 ble-face varname_array=none ble-face varname_empty=fg=gray ble-face varname_export=none ble-face varname_expr=none ble-face varname_hash=none ble-face varname_new=none ble-face varname_number=fg=151 ble-face varname_readonly=none ble-face varname_transform=none ble-face varname_unset=fg=gray ble-face vbell=reverse ble-face vbell_erase=bg=252 ble-face vbell_flash=fg=green,reverse ```
simonLeary42 commented 1 week ago

while looking at my theme I noticed that all the filename_* styles are not actually in effect since I set bleopt filename_ls_colors=$LS_COLORS.

akinomyoga commented 1 week ago

how to change the style of the filtered prefix in the autocomplete menu?

ble.sh doesn't provide the configuration interface for this.

it's shown as bold, but I'd like it to pop a bit more.

Unless it doesn't have a functional issue, I'd call it a preference. As I've explained in https://github.com/akinomyoga/ble.sh/issues/518#issuecomment-2401155760, I'm reluctant to add an option for every preference. If you want to adjust the behavior, you can modify ble.sh. The code that boldfaces the matching part is contained in the shell function ble/complete/menu-complete.class/render-item.

Looking around ble-face I saw that there is a highlight on the input line called menu_filter_input, and I saw that menu_filter_fixed was equal to bold. But then I changed menu_filter_fixed and nothing happened.

The faces menu_filter_input and menu_filter_fixed are unrelated to the faces used to show the menu items. As their names contain menu_filter, they are the faces for the menu_filter feature.

while looking at my theme I noticed that all the filename_* styles are not actually in effect since I set bleopt filename_ls_colors=$LS_COLORS.

Yes, it's documented.

akinomyoga commented 1 week ago

I'm reluctant to add an option for every preference.

If there are other reasons I might implement it (e.g. if other shells have a similar configuration). Hmm, Fish's fish_pager_color_prefix seems to be that.

simonLeary42 commented 1 week ago

It's not that I want to make it pretty, it's that it's difficult to read, I have to squint. In my case it's filenames with unix timestamps in them, so a long string of numbers with a common prefix. I have to look at the files in the autocomplete menu, find the border between "already typed" and "not typed yet", and then find out which file is newer by comparing the first number to the right of said border.

simonLeary42 commented 1 week ago

https://unix.stackexchange.com/questions/676975/how-do-you-set-the-colour-of-the-bash-tab-completion-when-colored-completion-pr

GNU readline colors this prefix when colored-completion-prefix is enabled, and for some reason it uses the value from LS_COLORS for a socket.

akinomyoga commented 1 week ago

It's not that I want to make it pretty, it's that it's difficult to read, I have to squint.

That seems to imply that the boldface in your terminal is always difficult to distinguish from the normal font width, and thus it seems an issue with the terminal font setting.

https://unix.stackexchange.com/questions/676975/how-do-you-set-the-colour-of-the-bash-tab-completion-when-colored-completion-pr

GNU readline colors this prefix when colored-completion-prefix is enabled, and for some reason it uses the value from LS_COLORS for a socket.

The information in the link seems to be old. Bash >= 5.2 has the *.readline-colored-completion-prefix entry in LS_COLORS for the Readline setting colored-completion-prefix on.

akinomyoga commented 1 week ago

Since fish and readline seem to support something, I'll add something, but it may take time. I'm busy.