Add GitHub action for labelling PRs
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent 4d6a775 · Browse files · 10 files·+504 added−179 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
10 files+504 added−179 removed
- tests:+106 added−0 removed
- other:+398 added−179 removed
Provenance
- Commit
0ff13dc- Tree
6e03aa7- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
4d6a775
10 files changed+504 added−179 removed
added:.github/workflows/labeler.yml+17 added
1234567891011121314151617name: Label PRs
on: pull_request_target: types: [opened, synchronize, reopened]
permissions: contents: read pull-requests: write
jobs: label: runs-on: ubuntu-latest steps: - uses: actions/labeler@v5 with: configuration-path: .github/labeler.ymladded:.github/labeler.yml+64 added
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364go: - changed-files: - any-glob-to-any-file: - src/** - main.go - go.mod - go.sum
shell: - changed-files: - any-glob-to-any-file: - shell/**
bash: - changed-files: - any-glob-to-any-file: - shell/**/*.bash
zsh: - changed-files: - any-glob-to-any-file: - shell/**/*.zsh
fish: - changed-files: - any-glob-to-any-file: - shell/**/*.fish
vim: - changed-files: - any-glob-to-any-file: - plugin/**
docs: - changed-files: - any-glob-to-any-file: - '*.md' - doc/** - man/**
ci: - changed-files: - any-glob-to-any-file: - .github/**
build: - changed-files: - any-glob-to-any-file: - Makefile - .goreleaser.yml - Dockerfile
test: - changed-files: - any-glob-to-any-file: - test/** - src/**/*_test.go
install: - changed-files: - any-glob-to-any-file: - install - install.ps1 - uninstallmodified:man/man1/fzf.1+12 added
132 unmodified lines133 134 # Use template to rearrange fields135 echo foo,bar,baz | fzf --delimiter , --with-nth '{n},{1},{3},{2},{1..2}'136 .RE137+.RS138+139+\fBchange\-with\-nth\fR action is only available when \fB\-\-with\-nth\fR is set.140+When \fB\-\-with\-nth\fR is used, fzf retains the original input lines in memory141+so they can be re\-transformed on the fly (e.g. \fB\-\-with\-nth ..\fR to keep142+the original presentation). This increases memory usage, so only use143+\fB\-\-with\-nth\fR when you actually need field transformation.144+.RE145 .TP146 .BI "\-\-accept\-nth=" "N[,..] or TEMPLATE"147 Define which fields to print on accept. The last delimiter is stripped from the148 output. For advanced transformation, you can provide a template containing1256 unmodified lines1405 .BR FZF_INPUT_STATE " Current input state (enabled, disabled, hidden)"1406 .br1407 .BR FZF_NTH " Current \-\-nth option"1408 .br1409+.BR FZF_WITH_NTH " Current \-\-with\-nth option"1410+.br1411 .BR FZF_PROMPT " Prompt string"1412 .br1413 .BR FZF_GHOST " Ghost string"1414 .br482 unmodified lines1897 \fBchange\-list\-label(...)\fR (change \fB\-\-list\-label\fR to the given string)1898 \fBchange\-multi\fR (enable multi-select mode with no limit)1899 \fBchange\-multi(...)\fR (enable multi-select mode with a limit or disable it with 0)1900 \fBchange\-nth(...)\fR (change \fB\-\-nth\fR option; rotate through the multiple options separated by '|')1901+ \fBchange\-with\-nth(...)\fR (change \fB\-\-with\-nth\fR option; rotate through the multiple options separated by '|')1902 \fBchange\-pointer(...)\fR (change \fB\-\-pointer\fR option)1903 \fBchange\-preview(...)\fR (change \fB\-\-preview\fR option)1904 \fBchange\-preview\-label(...)\fR (change \fB\-\-preview\-label\fR to the given string)1905 \fBchange\-preview\-window(...)\fR (change \fB\-\-preview\-window\fR option; rotate through the multiple option sets separated by '|')97 unmodified lines2003 \fBtransform\-header\-label(...)\fR (transform header label using an external command)2004 \fBtransform\-input\-label(...)\fR (transform input label using an external command)2005 \fBtransform\-list\-label(...)\fR (transform list label using an external command)2006 \fBtransform\-nth(...)\fR (transform nth using an external command)2007+ \fBtransform\-with\-nth(...)\fR (transform with-nth using an external command)2008 \fBtransform\-pointer(...)\fR (transform pointer using an external command)2009 \fBtransform\-preview\-label(...)\fR (transform preview label using an external command)2010 \fBtransform\-prompt(...)\fR (transform prompt string using an external command)2011 \fBtransform\-query(...)\fR (transform query string using an external command)209 unmodified linesmodified:src/actiontype_string.go+150 added-147 removed
36 unmodified lines37 _ = x[actChangeInputLabel-26]38 _ = x[actChangeListLabel-27]39 _ = x[actChangeMulti-28]40 _ = x[actChangeNth-29]41- _ = x[actChangePointer-30]42- _ = x[actChangePreview-31]43- _ = x[actChangePreviewLabel-32]44- _ = x[actChangePreviewWindow-33]45- _ = x[actChangePrompt-34]46- _ = x[actChangeQuery-35]47- _ = x[actClearScreen-36]48- _ = x[actClearQuery-37]49- _ = x[actClearSelection-38]50- _ = x[actClose-39]51- _ = x[actDeleteChar-40]52- _ = x[actDeleteCharEof-41]53- _ = x[actEndOfLine-42]54- _ = x[actFatal-43]55- _ = x[actForwardChar-44]56- _ = x[actForwardWord-45]57- _ = x[actForwardSubWord-46]58- _ = x[actKillLine-47]59- _ = x[actKillWord-48]60- _ = x[actKillSubWord-49]61- _ = x[actUnixLineDiscard-50]62- _ = x[actUnixWordRubout-51]63- _ = x[actYank-52]64- _ = x[actBackwardKillWord-53]65- _ = x[actBackwardKillSubWord-54]66- _ = x[actSelectAll-55]67- _ = x[actDeselectAll-56]68- _ = x[actToggle-57]69- _ = x[actToggleSearch-58]70- _ = x[actToggleAll-59]71- _ = x[actToggleDown-60]72- _ = x[actToggleUp-61]73- _ = x[actToggleIn-62]74- _ = x[actToggleOut-63]75- _ = x[actToggleTrack-64]76- _ = x[actToggleTrackCurrent-65]77- _ = x[actToggleHeader-66]78- _ = x[actToggleWrap-67]79- _ = x[actToggleWrapWord-68]80- _ = x[actToggleMultiLine-69]81- _ = x[actToggleHscroll-70]82- _ = x[actToggleRaw-71]83- _ = x[actEnableRaw-72]84- _ = x[actDisableRaw-73]85- _ = x[actTrackCurrent-74]86- _ = x[actToggleInput-75]87- _ = x[actHideInput-76]88- _ = x[actShowInput-77]89- _ = x[actUntrackCurrent-78]90- _ = x[actDown-79]91- _ = x[actDownMatch-80]92- _ = x[actUp-81]93- _ = x[actUpMatch-82]94- _ = x[actPageUp-83]95- _ = x[actPageDown-84]96- _ = x[actPosition-85]97- _ = x[actHalfPageUp-86]98- _ = x[actHalfPageDown-87]99- _ = x[actOffsetUp-88]100- _ = x[actOffsetDown-89]101- _ = x[actOffsetMiddle-90]102- _ = x[actJump-91]103- _ = x[actJumpAccept-92]104- _ = x[actPrintQuery-93]105- _ = x[actRefreshPreview-94]106- _ = x[actReplaceQuery-95]107- _ = x[actToggleSort-96]108- _ = x[actShowPreview-97]109- _ = x[actHidePreview-98]110- _ = x[actTogglePreview-99]111- _ = x[actTogglePreviewWrap-100]112- _ = x[actTogglePreviewWrapWord-101]113- _ = x[actTransform-102]114- _ = x[actTransformBorderLabel-103]115- _ = x[actTransformGhost-104]116- _ = x[actTransformHeader-105]117- _ = x[actTransformHeaderLines-106]118- _ = x[actTransformFooter-107]119- _ = x[actTransformHeaderLabel-108]120- _ = x[actTransformFooterLabel-109]121- _ = x[actTransformInputLabel-110]122- _ = x[actTransformListLabel-111]123- _ = x[actTransformNth-112]124- _ = x[actTransformPointer-113]125- _ = x[actTransformPreviewLabel-114]126- _ = x[actTransformPrompt-115]127- _ = x[actTransformQuery-116]128- _ = x[actTransformSearch-117]129- _ = x[actTrigger-118]130- _ = x[actBgTransform-119]131- _ = x[actBgTransformBorderLabel-120]132- _ = x[actBgTransformGhost-121]133- _ = x[actBgTransformHeader-122]134- _ = x[actBgTransformHeaderLines-123]135- _ = x[actBgTransformFooter-124]136- _ = x[actBgTransformHeaderLabel-125]137- _ = x[actBgTransformFooterLabel-126]138- _ = x[actBgTransformInputLabel-127]139- _ = x[actBgTransformListLabel-128]140- _ = x[actBgTransformNth-129]141- _ = x[actBgTransformPointer-130]142- _ = x[actBgTransformPreviewLabel-131]143- _ = x[actBgTransformPrompt-132]144- _ = x[actBgTransformQuery-133]145- _ = x[actBgTransformSearch-134]146- _ = x[actBgCancel-135]147- _ = x[actSearch-136]148- _ = x[actPreview-137]149- _ = x[actPreviewTop-138]150- _ = x[actPreviewBottom-139]151- _ = x[actPreviewUp-140]152- _ = x[actPreviewDown-141]153- _ = x[actPreviewPageUp-142]154- _ = x[actPreviewPageDown-143]155- _ = x[actPreviewHalfPageUp-144]156- _ = x[actPreviewHalfPageDown-145]157- _ = x[actPrevHistory-146]158- _ = x[actPrevSelected-147]159- _ = x[actPrint-148]160- _ = x[actPut-149]161- _ = x[actNextHistory-150]162- _ = x[actNextSelected-151]163- _ = x[actExecute-152]164- _ = x[actExecuteSilent-153]165- _ = x[actExecuteMulti-154]166- _ = x[actSigStop-155]167- _ = x[actBest-156]168- _ = x[actFirst-157]169- _ = x[actLast-158]170- _ = x[actReload-159]171- _ = x[actReloadSync-160]172- _ = x[actDisableSearch-161]173- _ = x[actEnableSearch-162]174- _ = x[actSelect-163]175- _ = x[actDeselect-164]176- _ = x[actUnbind-165]177- _ = x[actRebind-166]178- _ = x[actToggleBind-167]179- _ = x[actBecome-168]180- _ = x[actShowHeader-169]181- _ = x[actHideHeader-170]182- _ = x[actBell-171]183- _ = x[actExclude-172]184- _ = x[actExcludeMulti-173]185- _ = x[actAsync-174]41+ _ = x[actChangeWithNth-30]42+ _ = x[actChangePointer-31]43+ _ = x[actChangePreview-32]44+ _ = x[actChangePreviewLabel-33]45+ _ = x[actChangePreviewWindow-34]46+ _ = x[actChangePrompt-35]47+ _ = x[actChangeQuery-36]48+ _ = x[actClearScreen-37]49+ _ = x[actClearQuery-38]50+ _ = x[actClearSelection-39]51+ _ = x[actClose-40]52+ _ = x[actDeleteChar-41]53+ _ = x[actDeleteCharEof-42]54+ _ = x[actEndOfLine-43]55+ _ = x[actFatal-44]56+ _ = x[actForwardChar-45]57+ _ = x[actForwardWord-46]58+ _ = x[actForwardSubWord-47]59+ _ = x[actKillLine-48]60+ _ = x[actKillWord-49]61+ _ = x[actKillSubWord-50]62+ _ = x[actUnixLineDiscard-51]63+ _ = x[actUnixWordRubout-52]64+ _ = x[actYank-53]65+ _ = x[actBackwardKillWord-54]66+ _ = x[actBackwardKillSubWord-55]67+ _ = x[actSelectAll-56]68+ _ = x[actDeselectAll-57]69+ _ = x[actToggle-58]70+ _ = x[actToggleSearch-59]71+ _ = x[actToggleAll-60]72+ _ = x[actToggleDown-61]73+ _ = x[actToggleUp-62]74+ _ = x[actToggleIn-63]75+ _ = x[actToggleOut-64]76+ _ = x[actToggleTrack-65]77+ _ = x[actToggleTrackCurrent-66]78+ _ = x[actToggleHeader-67]79+ _ = x[actToggleWrap-68]80+ _ = x[actToggleWrapWord-69]81+ _ = x[actToggleMultiLine-70]82+ _ = x[actToggleHscroll-71]83+ _ = x[actToggleRaw-72]84+ _ = x[actEnableRaw-73]85+ _ = x[actDisableRaw-74]86+ _ = x[actTrackCurrent-75]87+ _ = x[actToggleInput-76]88+ _ = x[actHideInput-77]89+ _ = x[actShowInput-78]90+ _ = x[actUntrackCurrent-79]91+ _ = x[actDown-80]92+ _ = x[actDownMatch-81]93+ _ = x[actUp-82]94+ _ = x[actUpMatch-83]95+ _ = x[actPageUp-84]96+ _ = x[actPageDown-85]97+ _ = x[actPosition-86]98+ _ = x[actHalfPageUp-87]99+ _ = x[actHalfPageDown-88]100+ _ = x[actOffsetUp-89]101+ _ = x[actOffsetDown-90]102+ _ = x[actOffsetMiddle-91]103+ _ = x[actJump-92]104+ _ = x[actJumpAccept-93]105+ _ = x[actPrintQuery-94]106+ _ = x[actRefreshPreview-95]107+ _ = x[actReplaceQuery-96]108+ _ = x[actToggleSort-97]109+ _ = x[actShowPreview-98]110+ _ = x[actHidePreview-99]111+ _ = x[actTogglePreview-100]112+ _ = x[actTogglePreviewWrap-101]113+ _ = x[actTogglePreviewWrapWord-102]114+ _ = x[actTransform-103]115+ _ = x[actTransformBorderLabel-104]116+ _ = x[actTransformGhost-105]117+ _ = x[actTransformHeader-106]118+ _ = x[actTransformHeaderLines-107]119+ _ = x[actTransformFooter-108]120+ _ = x[actTransformHeaderLabel-109]121+ _ = x[actTransformFooterLabel-110]122+ _ = x[actTransformInputLabel-111]123+ _ = x[actTransformListLabel-112]124+ _ = x[actTransformNth-113]125+ _ = x[actTransformWithNth-114]126+ _ = x[actTransformPointer-115]127+ _ = x[actTransformPreviewLabel-116]128+ _ = x[actTransformPrompt-117]129+ _ = x[actTransformQuery-118]130+ _ = x[actTransformSearch-119]131+ _ = x[actTrigger-120]132+ _ = x[actBgTransform-121]133+ _ = x[actBgTransformBorderLabel-122]134+ _ = x[actBgTransformGhost-123]135+ _ = x[actBgTransformHeader-124]136+ _ = x[actBgTransformHeaderLines-125]137+ _ = x[actBgTransformFooter-126]138+ _ = x[actBgTransformHeaderLabel-127]139+ _ = x[actBgTransformFooterLabel-128]140+ _ = x[actBgTransformInputLabel-129]141+ _ = x[actBgTransformListLabel-130]142+ _ = x[actBgTransformNth-131]143+ _ = x[actBgTransformWithNth-132]144+ _ = x[actBgTransformPointer-133]145+ _ = x[actBgTransformPreviewLabel-134]146+ _ = x[actBgTransformPrompt-135]147+ _ = x[actBgTransformQuery-136]148+ _ = x[actBgTransformSearch-137]149+ _ = x[actBgCancel-138]150+ _ = x[actSearch-139]151+ _ = x[actPreview-140]152+ _ = x[actPreviewTop-141]153+ _ = x[actPreviewBottom-142]154+ _ = x[actPreviewUp-143]155+ _ = x[actPreviewDown-144]156+ _ = x[actPreviewPageUp-145]157+ _ = x[actPreviewPageDown-146]158+ _ = x[actPreviewHalfPageUp-147]159+ _ = x[actPreviewHalfPageDown-148]160+ _ = x[actPrevHistory-149]161+ _ = x[actPrevSelected-150]162+ _ = x[actPrint-151]163+ _ = x[actPut-152]164+ _ = x[actNextHistory-153]165+ _ = x[actNextSelected-154]166+ _ = x[actExecute-155]167+ _ = x[actExecuteSilent-156]168+ _ = x[actExecuteMulti-157]169+ _ = x[actSigStop-158]170+ _ = x[actBest-159]171+ _ = x[actFirst-160]172+ _ = x[actLast-161]173+ _ = x[actReload-162]174+ _ = x[actReloadSync-163]175+ _ = x[actDisableSearch-164]176+ _ = x[actEnableSearch-165]177+ _ = x[actSelect-166]178+ _ = x[actDeselect-167]179+ _ = x[actUnbind-168]180+ _ = x[actRebind-169]181+ _ = x[actToggleBind-170]182+ _ = x[actBecome-171]183+ _ = x[actShowHeader-172]184+ _ = x[actHideHeader-173]185+ _ = x[actBell-174]186+ _ = x[actExclude-175]187+ _ = x[actExcludeMulti-176]188+ _ = x[actAsync-177]189 }190 188-const _actionType_name = "actIgnoreactStartactClickactInvalidactBracketedPasteBeginactBracketedPasteEndactCharactMouseactBeginningOfLineactAbortactAcceptactAcceptNonEmptyactAcceptOrPrintQueryactBackwardCharactBackwardDeleteCharactBackwardDeleteCharEofactBackwardWordactBackwardSubWordactCancelactChangeBorderLabelactChangeGhostactChangeHeaderactChangeHeaderLinesactChangeFooteractChangeHeaderLabelactChangeFooterLabelactChangeInputLabelactChangeListLabelactChangeMultiactChangeNthactChangePointeractChangePreviewactChangePreviewLabelactChangePreviewWindowactChangePromptactChangeQueryactClearScreenactClearQueryactClearSelectionactCloseactDeleteCharactDeleteCharEofactEndOfLineactFatalactForwardCharactForwardWordactForwardSubWordactKillLineactKillWordactKillSubWordactUnixLineDiscardactUnixWordRuboutactYankactBackwardKillWordactBackwardKillSubWordactSelectAllactDeselectAllactToggleactToggleSearchactToggleAllactToggleDownactToggleUpactToggleInactToggleOutactToggleTrackactToggleTrackCurrentactToggleHeaderactToggleWrapactToggleWrapWordactToggleMultiLineactToggleHscrollactToggleRawactEnableRawactDisableRawactTrackCurrentactToggleInputactHideInputactShowInputactUntrackCurrentactDownactDownMatchactUpactUpMatchactPageUpactPageDownactPositionactHalfPageUpactHalfPageDownactOffsetUpactOffsetDownactOffsetMiddleactJumpactJumpAcceptactPrintQueryactRefreshPreviewactReplaceQueryactToggleSortactShowPreviewactHidePreviewactTogglePreviewactTogglePreviewWrapactTogglePreviewWrapWordactTransformactTransformBorderLabelactTransformGhostactTransformHeaderactTransformHeaderLinesactTransformFooteractTransformHeaderLabelactTransformFooterLabelactTransformInputLabelactTransformListLabelactTransformNthactTransformPointeractTransformPreviewLabelactTransformPromptactTransformQueryactTransformSearchactTriggeractBgTransformactBgTransformBorderLabelactBgTransformGhostactBgTransformHeaderactBgTransformHeaderLinesactBgTransformFooteractBgTransformHeaderLabelactBgTransformFooterLabelactBgTransformInputLabelactBgTransformListLabelactBgTransformNthactBgTransformPointeractBgTransformPreviewLabelactBgTransformPromptactBgTransformQueryactBgTransformSearchactBgCancelactSearchactPreviewactPreviewTopactPreviewBottomactPreviewUpactPreviewDownactPreviewPageUpactPreviewPageDownactPreviewHalfPageUpactPreviewHalfPageDownactPrevHistoryactPrevSelectedactPrintactPutactNextHistoryactNextSelectedactExecuteactExecuteSilentactExecuteMultiactSigStopactBestactFirstactLastactReloadactReloadSyncactDisableSearchactEnableSearchactSelectactDeselectactUnbindactRebindactToggleBindactBecomeactShowHeaderactHideHeaderactBellactExcludeactExcludeMultiactAsync"191+const _actionType_name = "actIgnoreactStartactClickactInvalidactBracketedPasteBeginactBracketedPasteEndactCharactMouseactBeginningOfLineactAbortactAcceptactAcceptNonEmptyactAcceptOrPrintQueryactBackwardCharactBackwardDeleteCharactBackwardDeleteCharEofactBackwardWordactBackwardSubWordactCancelactChangeBorderLabelactChangeGhostactChangeHeaderactChangeHeaderLinesactChangeFooteractChangeHeaderLabelactChangeFooterLabelactChangeInputLabelactChangeListLabelactChangeMultiactChangeNthactChangeWithNthactChangePointeractChangePreviewactChangePreviewLabelactChangePreviewWindowactChangePromptactChangeQueryactClearScreenactClearQueryactClearSelectionactCloseactDeleteCharactDeleteCharEofactEndOfLineactFatalactForwardCharactForwardWordactForwardSubWordactKillLineactKillWordactKillSubWordactUnixLineDiscardactUnixWordRuboutactYankactBackwardKillWordactBackwardKillSubWordactSelectAllactDeselectAllactToggleactToggleSearchactToggleAllactToggleDownactToggleUpactToggleInactToggleOutactToggleTrackactToggleTrackCurrentactToggleHeaderactToggleWrapactToggleWrapWordactToggleMultiLineactToggleHscrollactToggleRawactEnableRawactDisableRawactTrackCurrentactToggleInputactHideInputactShowInputactUntrackCurrentactDownactDownMatchactUpactUpMatchactPageUpactPageDownactPositionactHalfPageUpactHalfPageDownactOffsetUpactOffsetDownactOffsetMiddleactJumpactJumpAcceptactPrintQueryactRefreshPreviewactReplaceQueryactToggleSortactShowPreviewactHidePreviewactTogglePreviewactTogglePreviewWrapactTogglePreviewWrapWordactTransformactTransformBorderLabelactTransformGhostactTransformHeaderactTransformHeaderLinesactTransformFooteractTransformHeaderLabelactTransformFooterLabelactTransformInputLabelactTransformListLabelactTransformNthactTransformWithNthactTransformPointeractTransformPreviewLabelactTransformPromptactTransformQueryactTransformSearchactTriggeractBgTransformactBgTransformBorderLabelactBgTransformGhostactBgTransformHeaderactBgTransformHeaderLinesactBgTransformFooteractBgTransformHeaderLabelactBgTransformFooterLabelactBgTransformInputLabelactBgTransformListLabelactBgTransformNthactBgTransformWithNthactBgTransformPointeractBgTransformPreviewLabelactBgTransformPromptactBgTransformQueryactBgTransformSearchactBgCancelactSearchactPreviewactPreviewTopactPreviewBottomactPreviewUpactPreviewDownactPreviewPageUpactPreviewPageDownactPreviewHalfPageUpactPreviewHalfPageDownactPrevHistoryactPrevSelectedactPrintactPutactNextHistoryactNextSelectedactExecuteactExecuteSilentactExecuteMultiactSigStopactBestactFirstactLastactReloadactReloadSyncactDisableSearchactEnableSearchactSelectactDeselectactUnbindactRebindactToggleBindactBecomeactShowHeaderactHideHeaderactBellactExcludeactExcludeMultiactAsync"192 190-var _actionType_index = [...]uint16{0, 9, 17, 25, 35, 57, 77, 84, 92, 110, 118, 127, 144, 165, 180, 201, 225, 240, 258, 267, 287, 301, 316, 336, 351, 371, 391, 410, 428, 442, 454, 470, 486, 507, 529, 544, 558, 572, 585, 602, 610, 623, 639, 651, 659, 673, 687, 704, 715, 726, 740, 758, 775, 782, 801, 823, 835, 849, 858, 873, 885, 898, 909, 920, 932, 946, 967, 982, 995, 1012, 1030, 1046, 1058, 1070, 1083, 1098, 1112, 1124, 1136, 1153, 1160, 1172, 1177, 1187, 1196, 1207, 1218, 1231, 1246, 1257, 1270, 1285, 1292, 1305, 1318, 1335, 1350, 1363, 1377, 1391, 1407, 1427, 1451, 1463, 1486, 1503, 1521, 1544, 1562, 1585, 1608, 1630, 1651, 1666, 1685, 1709, 1727, 1744, 1762, 1772, 1786, 1811, 1830, 1850, 1875, 1895, 1920, 1945, 1969, 1992, 2009, 2030, 2056, 2076, 2095, 2115, 2126, 2135, 2145, 2158, 2174, 2186, 2200, 2216, 2234, 2254, 2276, 2290, 2305, 2313, 2319, 2333, 2348, 2358, 2374, 2389, 2399, 2406, 2414, 2421, 2430, 2443, 2459, 2474, 2483, 2494, 2503, 2512, 2525, 2534, 2547, 2560, 2567, 2577, 2592, 2600}193+var _actionType_index = [...]uint16{0, 9, 17, 25, 35, 57, 77, 84, 92, 110, 118, 127, 144, 165, 180, 201, 225, 240, 258, 267, 287, 301, 316, 336, 351, 371, 391, 410, 428, 442, 454, 470, 486, 502, 523, 545, 560, 574, 588, 601, 618, 626, 639, 655, 667, 675, 689, 703, 720, 731, 742, 756, 774, 791, 798, 817, 839, 851, 865, 874, 889, 901, 914, 925, 936, 948, 962, 983, 998, 1011, 1028, 1046, 1062, 1074, 1086, 1099, 1114, 1128, 1140, 1152, 1169, 1176, 1188, 1193, 1203, 1212, 1223, 1234, 1247, 1262, 1273, 1286, 1301, 1308, 1321, 1334, 1351, 1366, 1379, 1393, 1407, 1423, 1443, 1467, 1479, 1502, 1519, 1537, 1560, 1578, 1601, 1624, 1646, 1667, 1682, 1701, 1720, 1744, 1762, 1779, 1797, 1807, 1821, 1846, 1865, 1885, 1910, 1930, 1955, 1980, 2004, 2027, 2044, 2065, 2086, 2112, 2132, 2151, 2171, 2182, 2191, 2201, 2214, 2230, 2242, 2256, 2272, 2290, 2310, 2332, 2346, 2361, 2369, 2375, 2389, 2404, 2414, 2430, 2445, 2455, 2462, 2470, 2477, 2486, 2499, 2515, 2530, 2539, 2550, 2559, 2568, 2581, 2590, 2603, 2616, 2623, 2633, 2648, 2656}194 195 func (i actionType) String() string {196 if i < 0 || i >= actionType(len(_actionType_index)-1) {197 return "actionType(" + strconv.FormatInt(int64(i), 10) + ")"3 unmodified linesmodified:src/chunklist.go+15 added
97 unmodified lines98 cl.chunks = nil99 cl.mutex.Unlock()100 }101 102+// Retransform iterates all items and applies fn to each one.103+// The done callback runs under the lock to safely update shared state.104+func (cl *ChunkList) Retransform(fn func(*Item), done func()) {105+ cl.mutex.Lock()106+ for _, chunk := range cl.chunks {107+ for i := 0; i < chunk.count; i++ {108+ fn(&chunk.items[i])109+ }110+ }111+ if done != nil {112+ done()113+ }114+ cl.mutex.Unlock()115+}116+117 // Snapshot returns immutable snapshot of the ChunkList118 func (cl *ChunkList) Snapshot(tail int) ([]*Chunk, int, bool) {119 cl.mutex.Lock()120 50 unmodified linesmodified:src/core.go+66 added-30 removed
110 unmodified lines111 // Chunk list112 cache := NewChunkCache()113 var chunkList *ChunkList114 var itemIndex int32115+ // transformItem applies with-nth transformation to an item's raw data.116+ // It handles ANSI token propagation using prevLineAnsiState for cross-line continuity.117+ transformItem := func(item *Item, data []byte, transformer func([]Token, int32) string, index int32) {118+ tokens := Tokenize(byteString(data), opts.Delimiter)119+ if opts.Ansi && len(tokens) > 1 {120+ var ansiState *ansiState121+ if prevLineAnsiState != nil {122+ ansiStateDup := *prevLineAnsiState123+ ansiState = &ansiStateDup124+ }125+ for _, token := range tokens {126+ prevAnsiState := ansiState127+ _, _, ansiState = extractColor(token.text.ToString(), ansiState, nil)128+ if prevAnsiState != nil {129+ token.text.Prepend("\x1b[m" + prevAnsiState.ToString())130+ } else {131+ token.text.Prepend("\x1b[m")132+ }133+ }134+ }135+ transformed := transformer(tokens, index)136+ item.text, item.colors = ansiProcessor(stringBytes(transformed))137+138+ // We should not trim trailing whitespaces with background colors139+ var maxColorOffset int32140+ if item.colors != nil {141+ for _, ansi := range *item.colors {142+ if ansi.color.bg >= 0 {143+ maxColorOffset = max(maxColorOffset, ansi.offset[1])144+ }145+ }146+ }147+ item.text.TrimTrailingWhitespaces(int(maxColorOffset))148+ }149+150+ var nthTransformer func([]Token, int32) string151 if opts.WithNth == nil {152 chunkList = NewChunkList(cache, func(item *Item, data []byte) bool {153 item.text, item.colors = ansiProcessor(data)154 item.text.Index = itemIndex155 itemIndex++156 return true157 })158 } else {123- nthTransformer := opts.WithNth(opts.Delimiter)159+ nthTransformer = opts.WithNth(opts.Delimiter)160 chunkList = NewChunkList(cache, func(item *Item, data []byte) bool {125- tokens := Tokenize(byteString(data), opts.Delimiter)126- if opts.Ansi && len(tokens) > 1 {127- var ansiState *ansiState128- if prevLineAnsiState != nil {129- ansiStateDup := *prevLineAnsiState130- ansiState = &ansiStateDup131- }132- for _, token := range tokens {133- prevAnsiState := ansiState134- _, _, ansiState = extractColor(token.text.ToString(), ansiState, nil)135- if prevAnsiState != nil {136- token.text.Prepend("\x1b[m" + prevAnsiState.ToString())137- } else {138- token.text.Prepend("\x1b[m")139- }140- }161+ currentTransformer := nthTransformer162+ if currentTransformer == nil {163+ item.text, item.colors = ansiProcessor(data)164+ } else {165+ transformItem(item, data, currentTransformer, itemIndex)166 }142- transformed := nthTransformer(tokens, itemIndex)143- item.text, item.colors = ansiProcessor(stringBytes(transformed))144-145- // We should not trim trailing whitespaces with background colors146- var maxColorOffset int32147- if item.colors != nil {148- for _, ansi := range *item.colors {149- if ansi.color.bg >= 0 {150- maxColorOffset = max(maxColorOffset, ansi.offset[1])151- }152- }153- }154- item.text.TrimTrailingWhitespaces(int(maxColorOffset))167 item.text.Index = itemIndex168 item.origText = &data169 itemIndex++170 return true260 unmodified lines431 var command *commandSpec432 var environ []string433 var changed bool434 headerLinesChanged := false435+ withNthChanged := false436 switch val := value.(type) {437 case searchRequest:438 sort = val.sort439 command = val.command18 unmodified lines458 headerUpdated = false459 headerLinesChanged = true460 bump = true461 }462+ if val.withNth != nil {463+ newTransformer := val.withNth.fn464+ // Reset cross-line ANSI state before re-processing all items465+ lineAnsiState = nil466+ prevLineAnsiState = nil467+ chunkList.Retransform(func(item *Item) {468+ origBytes := *item.origText469+ savedIndex := item.Index()470+ if newTransformer != nil {471+ transformItem(item, origBytes, newTransformer, savedIndex)472+ } else {473+ item.text, item.colors = ansiProcessor(origBytes)474+ }475+ item.text.Index = savedIndex476+ item.transformed = nil477+ }, func() {478+ nthTransformer = newTransformer479+ })480+ withNthChanged = true481+ bump = true482+ }483 if bump {484 patternCache = make(map[string]*Pattern)485 cache.Clear()486 inputRevision.bumpMinor()35 unmodified lines522 terminal.UpdateHeader(GetItems(snapshot, int(headerLines)))523 } else {524 terminal.UpdateHeader(nil)525 }526+ } else if withNthChanged && headerLines > 0 {527+ terminal.UpdateHeader(GetItems(snapshot, int(headerLines)))528 }529 matcher.Reset(snapshot, input(), true, !reading, sort, snapshotRevision)530 delay = false531 53 unmodified linesmodified:src/options.go+9 added-1 removed
585 unmodified lines586 Nth []Range587 FreezeLeft int588 FreezeRight int589 WithNth func(Delimiter) func([]Token, int32) string590+ WithNthExpr string591 AcceptNth func(Delimiter) func([]Token, int32) string592 Delimiter Delimiter593 Sort int594 Raw bool1031 unmodified lines1626 )1627 1628 func init() {1629 executeRegexp = regexp.MustCompile(1629- `(?si)[:+](become|execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|bg-transform|transform)-(?:query|prompt|(?:border|list|preview|input|header|footer)-label|header-lines|header|footer|search|nth|pointer|ghost)|bg-transform|transform|change-(?:preview-window|preview|multi)|(?:re|un|toggle-)bind|pos|put|print|search|trigger)`)1630+ `(?si)[:+](become|execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|bg-transform|transform)-(?:query|prompt|(?:border|list|preview|input|header|footer)-label|header-lines|header|footer|search|with-nth|nth|pointer|ghost)|bg-transform|transform|change-(?:preview-window|preview|multi)|(?:re|un|toggle-)bind|pos|put|print|search|trigger)`)1631 splitRegexp = regexp.MustCompile("[,:]+")1632 actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+")1633 }1634 434 unmodified lines2069 case "change-multi":2070 return actChangeMulti2071 case "change-nth":2072 return actChangeNth2073+ case "change-with-nth":2074+ return actChangeWithNth2075 case "pos":2076 return actPosition2077 case "execute":2078 return actExecute28 unmodified lines2107 case "transform-ghost":2108 return actTransformGhost2109 case "transform-nth":2110 return actTransformNth2111+ case "transform-with-nth":2112+ return actTransformWithNth2113 case "transform-pointer":2114 return actTransformPointer2115 case "transform-prompt":2116 return actTransformPrompt24 unmodified lines2141 case "bg-transform-ghost":2142 return actBgTransformGhost2143 case "bg-transform-nth":2144 return actBgTransformNth2145+ case "bg-transform-with-nth":2146+ return actBgTransformWithNth2147 case "bg-transform-pointer":2148 return actBgTransformPointer2149 case "bg-transform-prompt":2150 return actBgTransformPrompt633 unmodified lines2784 }2785 if opts.WithNth, err = nthTransformer(str); err != nil {2786 return err2787 }2788+ opts.WithNthExpr = str2789 case "--accept-nth":2790 str, err := nextString("nth expression required")2791 if err != nil {2792 return err1105 unmodified linesmodified:src/terminal.go+57 added-1 removed
338 unmodified lines339 freezeRight int340 nthAttr tui.Attr341 nth []Range342 nthCurrent []Range343+ withNthExpr string344+ withNthEnabled bool345 acceptNth func([]Token, int32) string346 tabstop int347 margin [4]sizeSpec348 padding [4]sizeSpec36 unmodified lines385 hasFocusActions bool386 hasLoadActions bool387 hasResizeActions bool388 triggerLoad bool389+ filterSelection bool390 reading bool391 running *util.AtomicBool392 failed *string393 jumping jumpMode159 unmodified lines553 actChangeInputLabel554 actChangeListLabel555 actChangeMulti556 actChangeNth557+ actChangeWithNth558 actChangePointer559 actChangePreview560 actChangePreviewLabel561 actChangePreviewWindow77 unmodified lines639 actTransformFooterLabel640 actTransformInputLabel641 actTransformListLabel642 actTransformNth643+ actTransformWithNth644 actTransformPointer645 actTransformPreviewLabel646 actTransformPrompt647 actTransformQuery11 unmodified lines659 actBgTransformFooterLabel660 actBgTransformInputLabel661 actBgTransformListLabel662 actBgTransformNth663+ actBgTransformWithNth664 actBgTransformPointer665 actBgTransformPreviewLabel666 actBgTransformPrompt667 actBgTransformQuery58 unmodified lines726 actTransformFooterLabel,727 actTransformInputLabel,728 actTransformListLabel,729 actTransformNth,730+ actTransformWithNth,731 actTransformPointer,732 actTransformPreviewLabel,733 actTransformPrompt,734 actTransformQuery,8 unmodified lines743 actBgTransformFooterLabel,744 actBgTransformInputLabel,745 actBgTransformListLabel,746 actBgTransformNth,747+ actBgTransformWithNth,748 actBgTransformPointer,749 actBgTransformPreviewLabel,750 actBgTransformPrompt,751 actBgTransformQuery,21 unmodified lines773 file bool774 raw bool775 }776 777+type withNthSpec struct {778+ fn func([]Token, int32) string // nil = clear (restore original)779+}780+781 type searchRequest struct {782 sort bool783 sync bool784 nth *[]Range785+ withNth *withNthSpec786 headerLines *int787 command *commandSpec788 environ []string789 changed bool302 unmodified lines1092 freezeRight: opts.FreezeRight,1093 nthAttr: opts.Theme.Nth.Attr,1094 nth: opts.Nth,1095 nthCurrent: opts.Nth,1096+ withNthExpr: opts.WithNthExpr,1097+ withNthEnabled: opts.WithNth != nil,1098 tabstop: opts.Tabstop,1099 raw: opts.Raw,1100 hasStartActions: false,1101 hasResultActions: false,263 unmodified lines1365 env = append(env, "FZF_DIRECTION="+direction)1366 if len(t.nthCurrent) > 0 {1367 env = append(env, "FZF_NTH="+RangesToString(t.nthCurrent))1368 }1369+ if len(t.withNthExpr) > 0 {1370+ env = append(env, "FZF_WITH_NTH="+t.withNthExpr)1371+ }1372 if t.raw {1373 val := "0"1374 if t.isCurrentItemMatch() {1375 val = "1"484 unmodified lines1860 }1861 t.revision = newRevision1862 t.version++1863 }1864+ if t.filterSelection && t.multi > 0 && len(t.selected) > 0 {1865+ t.filterSelection = false1866+ matchMap := t.resultMerger.ToMap()1867+ filtered := make(map[int32]selectedItem)1868+ for k, v := range t.selected {1869+ if _, matched := matchMap[k]; matched {1870+ filtered[k] = v1871+ }1872+ }1873+ t.selected = filtered1874+ }1875+ t.filterSelection = false1876 if t.triggerLoad {1877 t.triggerLoad = false1878 t.eventChan <- tui.Load.AsEvent()1879 }4071 unmodified lines5951 // These variables are defined outside the loop to be accessible from closures5952 events := []util.EventType{}5953 changed := false5954 var newNth *[]Range5955+ var newWithNth *withNthSpec5956 var newHeaderLines *int5957 req := func(evts ...util.EventType) {5958 for _, event := range evts {5959 events = append(events, event)9 unmodified lines5969 var reloadSync bool5970 events = []util.EventType{}5971 changed = false5972 newNth = nil5973+ newWithNth = nil5974 newHeaderLines = nil5975 beof := false5976 queryChanged := false5977 denylist := []int32{}383 unmodified lines6361 t.nthCurrent = *newNth6362 t.forceRerenderList()6363 }6364 })6365+ case actChangeWithNth, actTransformWithNth, actBgTransformWithNth:6366+ if !t.withNthEnabled {6367+ break Action6368+ }6369+ capture(true, func(expr string) {6370+ tokens := strings.Split(expr, "|")6371+ withNthExpr := tokens[0]6372+ if len(tokens) > 1 {6373+ a.a = strings.Join(append(tokens[1:], tokens[0]), "|")6374+ }6375+ if withNthExpr != t.withNthExpr {6376+ if len(withNthExpr) == 0 {6377+ newWithNth = &withNthSpec{fn: nil}6378+ } else if factory, err := nthTransformer(withNthExpr); err == nil {6379+ newWithNth = &withNthSpec{fn: factory(t.delimiter)}6380+ } else {6381+ return6382+ }6383+ t.withNthExpr = withNthExpr6384+ t.filterSelection = true6385+ changed = true6386+ t.forceRerenderList()6387+ }6388+ })6389 case actChangeQuery:6390 t.input = []rune(a.a)6391 t.cx = len(t.input)6392 case actChangeHeader, actTransformHeader, actBgTransformHeader:1139 unmodified lines7532 7533 reload := changed || newCommand != nil7534 var reloadRequest *searchRequest7535 if reload {7480- reloadRequest = &searchRequest{sort: t.sort, sync: reloadSync, nth: newNth, headerLines: newHeaderLines, command: newCommand, environ: t.environ(), changed: changed, denylist: denylist, revision: t.resultMerger.Revision()}7536+ reloadRequest = &searchRequest{sort: t.sort, sync: reloadSync, nth: newNth, withNth: newWithNth, headerLines: newHeaderLines, command: newCommand, environ: t.environ(), changed: changed, denylist: denylist, revision: t.resultMerger.Revision()}7537 }7538 7539 // Dispatch queued background requests7540 t.dispatchAsync()227 unmodified linesmodified:test/test_core.rb+106 added
1743 unmodified lines1744 assert_equal 4, lines.match_count1745 end1746 end1747 1748+ def test_change_with_nth1749+ input = [1750+ 'foo bar baz',1751+ 'aaa bbb ccc',1752+ 'xxx yyy zzz'1753+ ]1754+ writelines(input)1755+ # Start with field 1 only, cycle through fields, verify $FZF_WITH_NTH via prompt1756+ tmux.send_keys %(#{FZF} --with-nth 1 --bind 'space:change-with-nth(2|3|1),result:transform-prompt:echo "[$FZF_WITH_NTH]> "' < #{tempname}), :Enter1757+ tmux.until do |lines|1758+ assert_equal 3, lines.item_count1759+ assert lines.any_include?('[1]>')1760+ assert lines.any_include?('foo')1761+ refute lines.any_include?('bar')1762+ end1763+ tmux.send_keys :Space1764+ tmux.until do |lines|1765+ assert lines.any_include?('[2]>')1766+ assert lines.any_include?('bar')1767+ refute lines.any_include?('foo')1768+ end1769+ tmux.send_keys :Space1770+ tmux.until do |lines|1771+ assert lines.any_include?('[3]>')1772+ assert lines.any_include?('baz')1773+ refute lines.any_include?('bar')1774+ end1775+ tmux.send_keys :Space1776+ tmux.until do |lines|1777+ assert lines.any_include?('[1]>')1778+ assert lines.any_include?('foo')1779+ refute lines.any_include?('bar')1780+ end1781+ end1782+1783+ def test_change_with_nth_clear1784+ tmux.send_keys %(echo -e 'a b c\nd e f' | #{FZF} --with-nth 1 --bind 'space:change-with-nth()'), :Enter1785+ tmux.until do |lines|1786+ assert_equal 2, lines.item_count1787+ assert lines.any_include?('a')1788+ refute lines.any_include?('b')1789+ end1790+ tmux.send_keys :Space1791+ tmux.until do |lines|1792+ assert lines.any_include?('a b c')1793+ end1794+ end1795+1796+ def test_transform_with_nth_search1797+ input = [1798+ 'alpha bravo charlie',1799+ 'delta echo foxtrot',1800+ 'golf hotel india'1801+ ]1802+ writelines(input)1803+ tmux.send_keys %(#{FZF} --with-nth 1 --bind 'space:transform-with-nth(2)' -q bravo < #{tempname}), :Enter1804+ tmux.until do |lines|1805+ assert_equal 0, lines.match_count1806+ end1807+ tmux.send_keys :Space1808+ tmux.until do |lines|1809+ assert_equal 1, lines.match_count1810+ end1811+ end1812+1813+ def test_bg_transform_with_nth_output1814+ tmux.send_keys %(echo -e 'a b c\nd e f' | #{FZF} --with-nth 2 --bind 'space:bg-transform-with-nth(3)'), :Enter1815+ tmux.until do |lines|1816+ assert_equal 2, lines.item_count1817+ assert lines.any_include?('b')1818+ end1819+ tmux.send_keys :Space1820+ tmux.until do |lines|1821+ assert lines.any_include?('c')1822+ end1823+ tmux.send_keys :Enter1824+ tmux.until { |lines| assert lines.any_include?('a b c') || lines.any_include?('d e f') }1825+ end1826+1827+ def test_change_with_nth_selection1828+ # Items: field1 has unique values, field2 has 'match' or 'miss'1829+ input = [1830+ 'one match x',1831+ 'two miss y',1832+ 'three match z'1833+ ]1834+ writelines(input)1835+ # Start showing field 2 (match/miss), query 'match', select all matches, then switch to field 31836+ tmux.send_keys %(#{FZF} --with-nth 2 --multi --bind 'ctrl-a:select-all,space:change-with-nth(3)' -q match < #{tempname}), :Enter1837+ tmux.until do |lines|1838+ assert_equal 2, lines.match_count1839+ end1840+ # Select all matching items1841+ tmux.send_keys 'C-a'1842+ tmux.until do |lines|1843+ assert lines.any_include?('(2)')1844+ end1845+ # Now change with-nth to field 3; 'x' and 'z' don't contain 'match'1846+ tmux.send_keys :Space1847+ tmux.until do |lines|1848+ assert_equal 0, lines.match_count1849+ # Selections of non-matching items should be cleared1850+ assert lines.any_include?('(0)')1851+ end1852+ end1853+1854 def test_env_vars1855 def env_vars1856 return {} unless File.exist?(tempname)1857 510 unmodified linesmodified:CHANGELOG.md+8 added
1 CHANGELOG2 =========3 4+0.69.05+------6+- Added `change-with-nth` action for dynamically changing the `--with-nth` option7+ ```sh8+ echo -e "a b c\nd e f\ng h i" | fzf --with-nth .. \9+ --bind 'space:change-with-nth(1|2|3|1,3|2,3|)'10+ ```11+12 0.68.013 ------14 - Implemented word wrapping in the list section15 - Added `--wrap=word` (or `--wrap-word`) option and `toggle-wrap-word` action for word-level line wrapping in the list section3167 unmodified lines