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.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this issue Jan 28, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [junegunn/fzf](https://github.com/junegunn/fzf) | minor | `v0.57.0` -> `v0.58.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>junegunn/fzf (junegunn/fzf)</summary>

### [`v0.58.0`](https://github.com/junegunn/fzf/releases/tag/v0.58.0): 0.58.0

[Compare Source](junegunn/fzf@v0.57.0...v0.58.0)

*Release highlights: https://junegunn.github.io/fzf/releases/0.58.0/*

This version introduces three new border types, `--list-border`, `--input-border`, and `--header-border`, offering much greater flexibility for customizing the user interface.

<img src="https://raw.githubusercontent.com/junegunn/i/master/fzf-4-borders.png" />

Also, fzf now offers "style presets" for quick customization, which can be activated using the `--style` option.

| Preset    | Screenshot                                                                             |
| :---      | :---                                                                                   |
| `default` | <img src="https://raw.githubusercontent.com/junegunn/i/master/fzf-style-default.png"/> |
| `full`    | <img src="https://raw.githubusercontent.com/junegunn/i/master/fzf-style-full.png"/>    |
| `minimal` | <img src="https://raw.githubusercontent.com/junegunn/i/master/fzf-style-minimal.png"/> |

-   Style presets ([#&#8203;4160](junegunn/fzf#4160))
    -   `--style=full[:BORDER_STYLE]`
    -   `--style=default`
    -   `--style=minimal`
-   Border and label for the list section ([#&#8203;4148](junegunn/fzf#4148))
    -   Options
        -   `--list-border[=STYLE]`
        -   `--list-label=LABEL`
        -   `--list-label-pos=COL[:bottom]`
    -   Colors
        -   `list-fg`
        -   `list-bg`
        -   `list-border`
        -   `list-label`
    -   Actions
        -   `change-list-label`
        -   `transform-list-label`
-   Border and label for the input section (prompt line and info line) ([#&#8203;4154](junegunn/fzf#4154))
    -   Options
        -   `--input-border[=STYLE]`
        -   `--input-label=LABEL`
        -   `--input-label-pos=COL[:bottom]`
    -   Colors
        -   `input-fg` (`query`)
        -   `input-bg`
        -   `input-border`
        -   `input-label`
    -   Actions
        -   `change-input-label`
        -   `transform-input-label`
-   Border and label for the header section ([#&#8203;4159](junegunn/fzf#4159))
    -   Options
        -   `--header-border[=STYLE]`
        -   `--header-label=LABEL`
        -   `--header-label-pos=COL[:bottom]`
    -   Colors
        -   `header-fg` (`header`)
        -   `header-bg`
        -   `header-border`
        -   `header-label`
    -   Actions
        -   `change-header-label`
        -   `transform-header-label`
-   Added `--preview-border[=STYLE]` as short for `--preview-window=border[-STYLE]`
-   Added new preview border style `line` which draws a single separator line between the preview window and the rest of the interface
-   fzf will now render a dashed line (`┈┈`) in each `--gap` for better visual separation.
    ```sh
    ```

### All bash/zsh functions, highlighted

declare -f |
perl -0 -pe 's/^}\n/}\0/gm' |
bat --plain --language bash --color always |
fzf --read0 --ansi --layout reverse --multi --highlight-line --gap

    ![](https://github.com/user-attachments/assets/203bf377-28da-4abf-a19c-d456ab1a72bb)
    - You can customize the line using `--gap-line[=STR]`.
    - You can specify `border-native` to `--tmux` so that native tmux border is used instead of `--border`. This can be useful if you start a different program from inside the popup.
    ```sh
    fzf --tmux border-native --bind 'enter:execute:less {}'

-   Added `toggle-multi-line` action
-   Added `toggle-hscroll` action
-   Added `change-nth` action for dynamically changing the value of the `--nth` option
    ```sh
    ```

### Start with --nth 1, then 2, then 3, then back to the default, 1

echo 'foo foobar foobarbaz' | fzf --bind 'space:change-nth(2|3|)' --nth 1 -q foo

    - `--nth` parts of each line can now be rendered in a different text style
    ```sh
    ### nth in a different style
    ls -al | fzf --nth -1 --color nth:italic
    ls -al | fzf --nth -1 --color nth:reverse
    ls -al | fzf --nth -1 --color nth:reverse:bold
    ### Dim the other parts
    ls -al | fzf --nth -1 --color nth:regular,fg:dim
    ### With 'change-nth'. The current nth option is exported as $FZF_NTH.
    ps -ef | fzf --reverse --header-lines 1 --header-border bottom --input-border \
               --color nth:regular,fg:dim \
               --bind 'ctrl-n:change-nth(8..|1|2|3|4|5|6|7|)' \
               --bind 'result:transform-prompt:echo "${FZF_NTH}> "'

![](https://junegunn.github.io/fzf/images/fzf-change-nth.gif)

-   A single-character delimiter is now treated as a plain string delimiter rather than a regular expression delimiter, even if it's a regular expression meta-character.
    -   This means you can just write `--delimiter '|'` instead of escaping it as `--delimiter '\|'`
-   Bug fixes
-   Bug fixes and improvements in fish scripts (thanks to [@&#8203;bitraid](https://github.com/bitraid))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMzcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjEzNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
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