Skip to content
Myr

Count $FZF_CLICK_HEADER_LINE from top to bottom

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Regardless of `--layout`. https://github.com/junegunn/fzf/pull/3768#issuecomment-2094806558

authored by Junegunn Choi · committed by Junegunn Choi · parent 7b98c2c · Browse files · 2 files+9 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • https: //github.com/junegunn/fzf/pull/3768#issuecomment-2094806558

Diff stats

2 files+9 added−14 removed

  • other:+9 added−14 removed

2 files+9 added−14 removed

modified:man/man1/fzf.1+1 added-1 removed
1278 unmodified lines
1279.RE12801281\fIclick-header\fR1282.RS1283Triggered when a mouse click occurs within the header. Sets \fBFZF_CLICK_HEADER_LINE\fR and \fBFZF_CLICK_HEADER_COLUMN\fR environment variables.1283Triggered 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.12841285e.g.1286 \fBprintf "head1\\nhead2" | fzf --header-lines=2 --bind 'click-header:transform-prompt:printf ${FZF_CLICK_HEADER_LINE}x${FZF_CLICK_HEADER_COLUMN}'\fR1287
282 unmodified lines
modified:src/terminal.go+8 added-13 removed
4021 unmodified lines
4022 evt = tui.SLeftClick4023 }4024 }4025 return doActions(actionsFor(evt))4026 } else {4026 } else if t.headerVisible {4027 // Header4028 lineOffset := 04028 numLines := t.visibleHeaderLines()4029 lineOffset := 04030 if !t.headerFirst {4031 // offset for info line4032 if t.noSeparatorLine() {4033 lineOffset = 14034 } else {4035 lineOffset = 24036 }4037 } else {4038 // adjust for too-small window4039 numItems := t.areaLines - numLines4040 if !t.noSeparatorLine() {4041 numItems -= 14042 }4043 if numItems < 0 {4044 numLines += numItems4045 }4037 }4047 my = util.Constrain(my-lineOffset, -1, numLines)4038 my -= lineOffset4039 mx -= 2 // offset gutter4040 if my >= 0 && my < numLines && mx >= 0 {4041 if t.layout == layoutReverse {4050 t.clickHeaderLine = my + 14042 t.clickHeaderLine = my + 14043 } else {4044 t.clickHeaderLine = numLines - my4045 }4046 t.clickHeaderColumn = mx + 14047 return doActions(actionsFor(tui.ClickHeader))4048 }4049 }
282 unmodified lines