Skip to content

[Question/Feature Request] Keep --prompt at absolute top when using --layout=reverse and --preview-window=up in multi-line PS1 #4798

Description

@marslo

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.72.0 (HEAD-6fefe02) and 0.72.0 (e0d08190)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

I have a question regarding the layout rendering, specifically when trying to seamlessly integrate fzf with a multi-line shell prompt using --layout=reverse.

I use a multi-line prompt in bash. When I press Ctrl+R, I want the fzf prompt to perfectly replace my second prompt line, keeping the visual connection with the first line intact.

Current Behavior

If I use --layout=reverse combined with --preview-window=up, the preview window is placed at the absolute top of the fzf canvas. This pushes the --prompt down, visually splitting my original shell prompt and the fzf prompt.

steps

unset PROMPT_COMMAND; export PS1=$'\nline1\nline2$ '
export FZF_DEFAULT_OPTS=''
export FZF_CTRL_R_OPTS="--layout=reverse --preview 'echo {}' --preview-window up:3:hidden --bind 'ctrl-\:toggle-preview' --prompt='line2$ '"

when I try preview the history, it shows

line1               <-- Bash prompt line 1
╭─ Preview ──────╮  <-- Preview window cuts in!
│ preview text   │
╰────────────────╯
line2$ >            <-- fzf prompt is pushed down here
  command 1
  command 2

expectation

line1               <-- Bash prompt line 1
line2$ >            <-- fzf prompt perfectly aligned!
╭─ Preview ──────╮  
│ preview text   │
╰────────────────╯
  command 1
  command 2

screenshots

  • without preview
Image
  • with preview
Image

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featureNew feature request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions