Skip to content

Commit

Permalink
menu (menu-style:desc): support multicolumns
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Dec 6, 2021
1 parent 4de1b45 commit 231dc39
Show file tree
Hide file tree
Showing 5 changed files with 325 additions and 159 deletions.
14 changes: 11 additions & 3 deletions blerc
Expand Up @@ -523,9 +523,9 @@
## inserts a new line before the candidates that does not fit into the
## remaining part of the current line. The value "align" and "align-nowrap"
## aligns the candidates. The value "linewise" shows a candidate per line. The
## value "desc" and "desc-raw" shows a candidate per line with description for
## each. "desc-raw" is different from "desc" in the behavior that it interprets
## ANSI escape sequences in the descriptions.
## value "desc" and "desc-text" shows a candidate per line with description for
## each. "desc-text" is different from "desc" in the behavior that it does not
## interprets ANSI escape sequences in the descriptions.

#bleopt complete_menu_style=align-nowrap

Expand All @@ -542,13 +542,21 @@

#bleopt complete_menu_maxlines=10


## The following setting specifies the prefix for complete_menu_style=linewise.
## For example, the candidate number can be shown by setting the value "%d".
## ANSI escape sequences can be used.

#bleopt menu_linewise_prefix=


## The following setting specifies the minimum column width for the multicolumn
## description for `complete_menu_style=desc'. When the empty value is
## specified, the multicolumn mode is disabled.

#bleopt menu_desc_multicolumn_width=65


##-----------------------------------------------------------------------------
## Color settings

Expand Down
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Expand Up @@ -79,6 +79,7 @@
- edit: support `bleopt canvas_winch_action` (requested by Johann-Goncalves-Pereira, guptapriyanshu7) `#D1679` 2243e91
- blerc: fix the name of the option `bleopt canvas_winch_action` (reported by Knusper) 0000000
- menu (menu-style:desc): improve descriptions (motivated by Shahabaz-Bagwan) `#D1685` 0000000
- menu (menu-style:desc): support multicolumns (motivated by Shahabaz-Bagwan) `#D1686` 0000000

## Changes

Expand Down
8 changes: 4 additions & 4 deletions lib/core-complete-def.sh
Expand Up @@ -58,13 +58,12 @@ bleopt/declare -v complete_allow_reduction ''
## @bleopt complete_menu_style
## 補完候補のリスト表示のスタイルを指定します。
##
## dense
## dense-nowrap
## align
## align-nowrap
## dense, dense-nowrap, align, align-nowrap
## desc, desc-text
##
bleopt/declare -n complete_menu_style align-nowrap
function bleopt/check:complete_menu_style {
[[ $value == desc-raw ]] && value=desc
if ! ble/is-function "ble/complete/menu-style:$value/construct-page"; then
ble/util/print-lines \
"bleopt: Invalid value complete_menu_style='$value'." \
Expand All @@ -80,6 +79,7 @@ ble/util/autoload "$_ble_base/lib/core-complete.sh" \
ble/complete/menu-style:desc{,-raw}/construct-page

bleopt/declare -v menu_linewise_prefix ''
bleopt/declare -v menu_desc_multicolumn_width 65
bleopt/declare -n complete_menu_align 20
bleopt/declare -v complete_menu_complete 1
bleopt/declare -v complete_menu_filter 1
Expand Down

0 comments on commit 231dc39

Please sign in to comment.