diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2024-05-06 09:27:58 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-05-06 09:27:58 +0900 |
commit | bf184449bc8f5d6a2e4df8a86fd4d333c85cca53 (patch) | |
tree | af847ca1017eb4d7c0a48194504732a457d6c7dc /src | |
parent | 7b98c2c653389e422aa429728298dd84b7cc18b8 (diff) |
Count $FZF_CLICK_HEADER_LINE from top to bottom
Regardless of `--layout`.
https://github.com/junegunn/fzf/pull/3768#issuecomment-2094806558
Diffstat (limited to 'src')
-rw-r--r-- | src/terminal.go | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/terminal.go b/src/terminal.go index a9eb6582..918c4244 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -4023,10 +4023,10 @@ func (t *Terminal) Loop() { } } return doActions(actionsFor(evt)) - } else { + } else if t.headerVisible { // Header - lineOffset := 0 numLines := t.visibleHeaderLines() + lineOffset := 0 if !t.headerFirst { // offset for info line if t.noSeparatorLine() { @@ -4034,20 +4034,15 @@ func (t *Terminal) Loop() { } else { lineOffset = 2 } - } else { - // adjust for too-small window - numItems := t.areaLines - numLines - if !t.noSeparatorLine() { - numItems -= 1 - } - if numItems < 0 { - numLines += numItems - } } - my = util.Constrain(my-lineOffset, -1, numLines) + my -= lineOffset mx -= 2 // offset gutter if my >= 0 && my < numLines && mx >= 0 { - t.clickHeaderLine = my + 1 + if t.layout == layoutReverse { + t.clickHeaderLine = my + 1 + } else { + t.clickHeaderLine = numLines - my + } t.clickHeaderColumn = mx + 1 return doActions(actionsFor(tui.ClickHeader)) } |