Skip to content

Commit

Permalink
Fix --layout reverse-list --no-input
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Feb 1, 2025
1 parent 6c0ca4a commit d075c00
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -2184,9 +2184,12 @@ func (t *Terminal) move(y int, x int, clear bool) {
case layoutDefault:
y = h - y - 1
case layoutReverseList:
n := 2 + t.visibleHeaderLinesInList()
if t.noSeparatorLine() {
n--
n := t.visibleHeaderLinesInList()
if !t.inputless {
n++
}
if !t.noSeparatorLine() {
n++
}
if y < n {
y = h - y - 1
Expand Down
15 changes: 15 additions & 0 deletions test/test_layout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -891,4 +891,19 @@ def test_min_height_auto_no_input
BLOCK
tmux.until { assert_block(block, _1) }
end

def test_min_height_auto_no_input_reverse_list
tmux.send_keys %(seq 100 | #{FZF} --style full:sharp --layout reverse-list --no-input --height 1% --min-height 5+), :Enter

block = <<~BLOCK
┌─────────
│ > 1
│ 2
│ 3
│ 4
│ 5
└─────────
BLOCK
tmux.until { assert_block(block, _1) }
end
end

2 comments on commit d075c00

@fsc0
Copy link

@fsc0 fsc0 commented on d075c00 Feb 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I thought that was intented layout.
Gj Gj 👍

@junegunn
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized reverse-list has some more issues, more fixes will be coming.

Please sign in to comment.