Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional border for the list section #4148

Closed
junegunn opened this issue Dec 29, 2024 · 2 comments
Closed

Additional border for the list section #4148

junegunn opened this issue Dec 29, 2024 · 2 comments
Assignees
Labels

Comments

@junegunn
Copy link
Owner

junegunn commented Dec 29, 2024

Summary

  • Add --list-border option to draw additional border around the list section
  • Also add --list-label and --list-label-pos, similar to --border-label and --border-label-pos, for placing label on the inner border

Objective

  • Provide greater flexibility for UI customization

Examples

git ls-files | fzf \
    --preview 'bat --color=always {} --style=numbers' --info inline-right \
    --list-border --list-label ' Result ' --preview-label ' Preview '
image
git ls-files | fzf \
    --preview 'bat --color=always {} --style=numbers' --info inline-right \
    --list-border \
    --bind 'result:transform-list-label:
        if [[ -z $FZF_QUERY ]]; then
          echo " $FZF_MATCH_COUNT items "
        else
          echo " $FZF_MATCH_COUNT matches for [$FZF_QUERY] "
        fi
        ' \
    --bind 'focus:transform-preview-label:[[ -n {} ]] && printf " Previewing [%s] " {}' \
    --bind 'ctrl-r:change-list-label( Reloading the list )+reload(sleep 2; git ls-files)' \
    --color 'list-border:#669966,list-label:#99cc99,preview-border:#9999cc,preview-label:#ccccff' \
    --border --border-label ' Demo ' --padding 1,2
image
git ls-files | fzf \
    --preview 'bat --color=always {} --style=numbers' --info inline-right \
    --list-border thinblock --preview-window border-thinblock \
    --list-label-pos bottom --preview-label-pos bottom \
    --bind 'result:transform-list-label:
        if [[ -z $FZF_QUERY ]]; then
          echo " $FZF_MATCH_COUNT items "
        else
          echo " $FZF_MATCH_COUNT matches for [$FZF_QUERY] "
        fi
        ' \
    --bind 'focus:transform-preview-label:[[ -n {} ]] && printf " Previewing [%s] " {}' \
    --bind 'ctrl-r:change-list-label( Reloading the list )+reload(sleep 2; git ls-files)' \
    --color 'bg:#222222,border:#333333,list-bg:#334433,preview-bg:#333344,list-border:#669966,list-label:#99cc99,preview-border:#9999cc,preview-label:#ccccff' \
    --border thinblock --border-label ' Demo ' --border-label-pos bottom --padding 1,2
image
@junegunn junegunn self-assigned this Dec 29, 2024
@bitraid
Copy link
Contributor

bitraid commented Dec 31, 2024

Thank you for all your work and continuous enhancements.
It seems to work fine, you only forgot to add:

diff --git a/src/options.go b/src/options.go
index bc0ddeb..b467b24 100644
--- a/src/options.go
+++ b/src/options.go
@@ -2637,6 +2637,10 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
 				if opts.ListBorderShape, err = parseBorder(value, false); err != nil {
 					return err
 				}
+			} else if match, value := optString(arg, "--list-border="); match {
+				if opts.BorderShape, err = parseBorder(value, false); err != nil {
+					return err
+				}
 			} else if match, value := optString(arg, "--list-label="); match {
 				opts.ListLabel.label = value
 			} else if match, value := optString(arg, "--list-label-pos="); match {

@junegunn
Copy link
Owner Author

@bitraid Thanks! Fixed in fd513f8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants