mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-22 19:09:00 +00:00
Count $FZF_CLICK_HEADER_LINE from top to bottom
Regardless of `--layout`. https://github.com/junegunn/fzf/pull/3768#issuecomment-2094806558
This commit is contained in:
parent
7b98c2c653
commit
bf184449bc
@ -1280,7 +1280,7 @@ e.g.
|
||||
|
||||
\fIclick-header\fR
|
||||
.RS
|
||||
Triggered when a mouse click occurs within the header. Sets \fBFZF_CLICK_HEADER_LINE\fR and \fBFZF_CLICK_HEADER_COLUMN\fR environment variables.
|
||||
Triggered when a mouse click occurs within the header. Sets \fBFZF_CLICK_HEADER_LINE\fR and \fBFZF_CLICK_HEADER_COLUMN\fR environment variables starting from 1.
|
||||
|
||||
e.g.
|
||||
\fBprintf "head1\\nhead2" | fzf --header-lines=2 --bind 'click-header:transform-prompt:printf ${FZF_CLICK_HEADER_LINE}x${FZF_CLICK_HEADER_COLUMN}'\fR
|
||||
|
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user