Skip to content
Myr

core.go

This file

Path

src/core.go

417 lines · 10.5 KiB · Go

Last changed by

Add --tmux option to replace fzf-tmux scriptJunegunn Choibefore adoption83b6033

History of this file

Take it

The walk stopped after 200 commits: lines older than d75bb5c point at it.

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 1–4why, one step back
1// Package fzf implements fzf, a command-line fuzzy finder.
2package fzf34import (

Add --tmux option to replace fzf-tmux scriptJunegunn Choibefore adoption83b6033

line 5why, one step back
5 "os"

Fix streaming filter mode by not running reader callback concurrentlyJunegunn Choibefore adoption3acb4ca

line 6why, one step back
6 "sync"

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 7–21why, one step back
7 "time"
89 "github.com/junegunn/fzf/src/util"10)1112/*13Reader -> EvtReadFin14Reader -> EvtReadNew -> Matcher (restart)15Terminal -> EvtSearchNew:bool -> Matcher (restart)16Matcher -> EvtSearchProgress -> Terminal (update info)17Matcher -> EvtSearchFin -> Terminal (update list)18Matcher -> EvtHeader -> Terminal (update header)19*/2021// Run starts fzf

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

line 22why, one step back
22func Run(opts *Options) (int, error) {

Add --tmux option to replace fzf-tmux scriptJunegunn Choibefore adoption83b6033

lines 23–26why, one step back
23 if opts.Tmux != nil && len(os.Getenv("TMUX")) > 0 {
24 return runTmux(os.Args[1:], opts)25 }26

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 27–30why, one step back
27 if err := postProcessOptions(opts); err != nil {
28 return ExitError, err29 }30

Enable profiling options when 'pprof' tag is set (#2813)Charlie Viethbefore adoption3c877c5

lines 31–32why, one step back
31 defer util.RunAtExitFuncs()
32

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 33–36why, one step back
33 // Output channel given
34 if opts.Output != nil {35 opts.Printer = func(str string) {36 opts.Output <- str

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 37–39why, one step back
37 }
38 }39

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 40–42why, one step back
40 sort := opts.Sort > 0
41 sortCriteria = opts.Criteria42

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 43–55why, one step back
43 // Event channel
44 eventBox := util.NewEventBox()4546 // ANSI code processor47 ansiProcessor := func(data []byte) (util.Chars, *[]ansiOffset) {48 return util.ToChars(data), nil49 }5051 var lineAnsiState, prevLineAnsiState *ansiState52 if opts.Ansi {53 if opts.Theme.Colored {54 ansiProcessor = func(data []byte) (util.Chars, *[]ansiOffset) {55 prevLineAnsiState = lineAnsiState

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

line 56why, one step back
56 trimmed, offsets, newState := extractColor(byteString(data), lineAnsiState, nil)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

line 57why, one step back
57 lineAnsiState = newState

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

line 58why, one step back
58 return util.ToChars(stringBytes(trimmed)), offsets

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 59–63why, one step back
59 }
60 } else {61 // When color is disabled but ansi option is given,62 // we simply strip out ANSI codes from the input63 ansiProcessor = func(data []byte) (util.Chars, *[]ansiOffset) {

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

lines 64–65why, one step back
64 trimmed, _, _ := extractColor(byteString(data), nil, nil)
65 return util.ToChars(stringBytes(trimmed)), nil

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 66–76why, one step back
66 }
67 }68 }6970 // Chunk list71 var chunkList *ChunkList72 var itemIndex int3273 header := make([]string, 0, opts.HeaderLines)74 if len(opts.WithNth) == 0 {75 chunkList = NewChunkList(func(item *Item, data []byte) bool {76 if len(header) < opts.HeaderLines {

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

line 77why, one step back
77 header = append(header, byteString(data))

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 78–87why, one step back
78 eventBox.Set(EvtHeader, header)
79 return false80 }81 item.text, item.colors = ansiProcessor(data)82 item.text.Index = itemIndex83 itemIndex++84 return true85 })86 } else {87 chunkList = NewChunkList(func(item *Item, data []byte) bool {

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

line 88why, one step back
88 tokens := Tokenize(byteString(data), opts.Delimiter)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 89–111why, one step back
89 if opts.Ansi && opts.Theme.Colored && len(tokens) > 1 {
90 var ansiState *ansiState91 if prevLineAnsiState != nil {92 ansiStateDup := *prevLineAnsiState93 ansiState = &ansiStateDup94 }95 for _, token := range tokens {96 prevAnsiState := ansiState97 _, _, ansiState = extractColor(token.text.ToString(), ansiState, nil)98 if prevAnsiState != nil {99 token.text.Prepend("\x1b[m" + prevAnsiState.ToString())100 } else {101 token.text.Prepend("\x1b[m")102 }103 }104 }105 trans := Transform(tokens, opts.WithNth)106 transformed := joinTokens(trans)107 if len(header) < opts.HeaderLines {108 header = append(header, transformed)109 eventBox.Set(EvtHeader, header)110 return false111 }

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

line 112why, one step back
112 item.text, item.colors = ansiProcessor(stringBytes(transformed))

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 113–120why, one step back
113 item.text.TrimTrailingWhitespaces()
114 item.text.Index = itemIndex115 item.origText = &data116 itemIndex++117 return true118 })119 }120

Add --with-shell for shelling out with different command and flags (#3746)Junegunn Choibefore adoptiona4391ae

lines 121–123why, one step back
121 // Process executor
122 executor := util.NewExecutor(opts.WithShell)123

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 124–129why, one step back
124 // Reader
125 streamingFilter := opts.Filter != nil && !sort && !opts.Tac && !opts.Sync126 var reader *Reader127 if !streamingFilter {128 reader = NewReader(func(data []byte) bool {129 return chunkList.Push(data)

Add --with-shell for shelling out with different command and flags (#3746)Junegunn Choibefore adoptiona4391ae

line 130why, one step back
130 }, eventBox, executor, opts.ReadZero, opts.Filter == nil)

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

line 131why, one step back
131 go reader.ReadSource(opts.Input, opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 132–146why, one step back
132 }
133134 // Matcher135 forward := true136 withPos := false137 for idx := len(opts.Criteria) - 1; idx > 0; idx-- {138 switch opts.Criteria[idx] {139 case byChunk:140 withPos = true141 case byEnd:142 forward = false143 case byBegin:144 forward = true145 }146 }

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 147–148why, one step back
147 cache := NewChunkCache()
148 patternCache := make(map[string]*Pattern)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

line 149why, one step back
149 patternBuilder := func(runes []rune) *Pattern {

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

line 150why, one step back
150 return BuildPattern(cache, patternCache,

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 151–155why, one step back
151 opts.Fuzzy, opts.FuzzyAlgo, opts.Extended, opts.Case, opts.Normalize, forward, withPos,
152 opts.Filter == nil, opts.Nth, opts.Delimiter, runes)153 }154 inputRevision := 0155 snapshotRevision := 0

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

line 156why, one step back
156 matcher := NewMatcher(cache, patternBuilder, sort, opts.Tac, eventBox, inputRevision)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 157–169why, one step back
157
158 // Filtering mode159 if opts.Filter != nil {160 if opts.PrintQuery {161 opts.Printer(*opts.Filter)162 }163164 pattern := patternBuilder([]rune(*opts.Filter))165 matcher.sort = pattern.sortable166167 found := false168 if streamingFilter {169 slab := util.MakeSlab(slab16Size, slab32Size)

Fix streaming filter mode by not running reader callback concurrentlyJunegunn Choibefore adoption3acb4ca

line 170why, one step back
170 mutex := sync.Mutex{}

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 171–174why, one step back
171 reader := NewReader(
172 func(runes []byte) bool {173 item := Item{}174 if chunkList.trans(&item, runes) {

Fix streaming filter mode by not running reader callback concurrentlyJunegunn Choibefore adoption3acb4ca

line 175why, one step back
175 mutex.Lock()

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 176–179why, one step back
176 if result, _, _ := pattern.MatchItem(&item, false, slab); result != nil {
177 opts.Printer(item.text.ToString())178 found = true179 }

Fix streaming filter mode by not running reader callback concurrentlyJunegunn Choibefore adoption3acb4ca

line 180why, one step back
180 mutex.Unlock()

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 181–182why, one step back
181 }
182 return false

Add --with-shell for shelling out with different command and flags (#3746)Junegunn Choibefore adoptiona4391ae

line 183why, one step back
183 }, eventBox, executor, opts.ReadZero, false)

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

line 184why, one step back
184 reader.ReadSource(opts.Input, opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 185–198why, one step back
185 } else {
186 eventBox.Unwatch(EvtReadNew)187 eventBox.WaitFor(EvtReadFin)188189 snapshot, _ := chunkList.Snapshot()190 merger, _ := matcher.scan(MatchRequest{191 chunks: snapshot,192 pattern: pattern})193 for i := 0; i < merger.Length(); i++ {194 opts.Printer(merger.Get(i).item.AsString(opts.Ansi))195 found = true196 }197 }198 if found {

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

line 199why, one step back
199 return ExitOk, nil

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

line 200why, one step back
200 }

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

line 201why, one step back
201 return ExitNoMatch, nil

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 202–211why, one step back
202 }
203204 // Synchronous search205 if opts.Sync {206 eventBox.Unwatch(EvtReadNew)207 eventBox.WaitFor(EvtReadFin)208 }209210 // Go interactive211 go matcher.Loop()

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

line 212why, one step back
212 defer matcher.Stop()

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 213–214why, one step back
213
214 // Terminal I/O

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 215–218why, one step back
215 terminal, err := NewTerminal(opts, eventBox, executor)
216 if err != nil {217 return ExitError, err218 }

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 219–234why, one step back
219 maxFit := 0 // Maximum number of items that can fit on screen
220 padHeight := 0221 heightUnknown := opts.Height.auto222 if heightUnknown {223 maxFit, padHeight = terminal.MaxFitAndPad()224 }225 deferred := opts.Select1 || opts.Exit0226 go terminal.Loop()227 if !deferred && !heightUnknown {228 // Start right away229 terminal.startChan <- fitpad{-1, -1}230 }231232 // Event coordination233 reading := true234 ticks := 0

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

line 235why, one step back
235 var nextCommand *commandSpec

Export FZF_* variables to 'reload' process as wellJunegunn Choibefore adoption5e6788c

line 236why, one step back
236 var nextEnviron []string

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 237–255why, one step back
237 eventBox.Watch(EvtReadNew)
238 total := 0239 query := []rune{}240 determine := func(final bool) {241 if heightUnknown {242 if total >= maxFit || final {243 deferred = false244 heightUnknown = false245 terminal.startChan <- fitpad{util.Min(total, maxFit), padHeight}246 }247 } else if deferred {248 deferred = false249 terminal.startChan <- fitpad{-1, -1}250 }251 }252253 useSnapshot := false254 var snapshot []*Chunk255 var count int

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

line 256why, one step back
256 restart := func(command commandSpec, environ []string) {

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 257–261why, one step back
257 reading = true
258 chunkList.Clear()259 itemIndex = 0260 inputRevision++261 header = make([]string, 0, opts.HeaderLines)

Export FZF_* variables to 'reload' process as wellJunegunn Choibefore adoption5e6788c

line 262why, one step back
262 go reader.restart(command, environ)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

line 263why, one step back
263 }

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 264–266why, one step back
264
265 exitCode := ExitOk266 stop := false

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 267–271why, one step back
267 for {
268 delay := true269 ticks++270 input := func() []rune {271 paused, input := terminal.Input()

Fix reload and reload-sync behaviorsJunegunn Choibefore adoption008fb9d

line 272why, one step back
272 if !paused {

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 273–286why, one step back
273 query = input
274 }275 return query276 }277 eventBox.Wait(func(events *util.Events) {278 if _, fin := (*events)[EvtReadFin]; fin {279 delete(*events, EvtReadNew)280 }281 for evt, value := range *events {282 switch evt {283 case EvtQuit:284 if reading {285 reader.terminate()286 }

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 287–291why, one step back
287 quitSignal := value.(quitSignal)
288 exitCode = quitSignal.code289 err = quitSignal.err290 stop = true291 return

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 292–293why, one step back
292 case EvtReadNew, EvtReadFin:
293 if evt == EvtReadFin && nextCommand != nil {

Export FZF_* variables to 'reload' process as wellJunegunn Choibefore adoption5e6788c

line 294why, one step back
294 restart(*nextCommand, nextEnviron)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

line 295why, one step back
295 nextCommand = nil

Export FZF_* variables to 'reload' process as wellJunegunn Choibefore adoption5e6788c

line 296why, one step back
296 nextEnviron = nil

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 297–304why, one step back
297 break
298 } else {299 reading = reading && evt == EvtReadNew300 }301 if useSnapshot && evt == EvtReadFin {302 useSnapshot = false303 }304 if !useSnapshot {

Fix reload and reload-sync behaviorsJunegunn Choibefore adoption008fb9d

lines 305–307why, one step back
305 if snapshotRevision != inputRevision {
306 query = []rune{}307 }

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 308–313why, one step back
308 snapshot, count = chunkList.Snapshot()
309 snapshotRevision = inputRevision310 }311 total = count312 terminal.UpdateCount(total, !reading, value.(*string))313 if opts.Sync {

Remove invalid 'result' event when using --sync optionJunegunn Choibefore adoptiond8bfb67

line 314why, one step back
314 terminal.UpdateList(PassMerger(&snapshot, opts.Tac, snapshotRevision), false)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 315–321why, one step back
315 }
316 if heightUnknown && !deferred {317 determine(!reading)318 }319 matcher.Reset(snapshot, input(), false, !reading, sort, snapshotRevision)320321 case EvtSearchNew:

Refactor the code to remove global variablesJunegunn Choibefore adoption4bedd33

line 322why, one step back
322 var command *commandSpec

Export FZF_* variables to 'reload' process as wellJunegunn Choibefore adoption5e6788c

line 323why, one step back
323 var environ []string

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 324–328why, one step back
324 var changed bool
325 switch val := value.(type) {326 case searchRequest:327 sort = val.sort328 command = val.command

Export FZF_* variables to 'reload' process as wellJunegunn Choibefore adoption5e6788c

line 329why, one step back
329 environ = val.environ

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 330–338why, one step back
330 changed = val.changed
331 if command != nil {332 useSnapshot = val.sync333 }334 }335 if command != nil {336 if reading {337 reader.terminate()338 nextCommand = command

Export FZF_* variables to 'reload' process as wellJunegunn Choibefore adoption5e6788c

line 339why, one step back
339 nextEnviron = environ

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

line 340why, one step back
340 } else {

Export FZF_* variables to 'reload' process as wellJunegunn Choibefore adoption5e6788c

line 341why, one step back
341 restart(*command, environ)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 342–347why, one step back
342 }
343 }344 if !changed {345 break346 }347 if !useSnapshot {

Fix reload and reload-sync behaviorsJunegunn Choibefore adoption008fb9d

line 348why, one step back
348 newSnapshot, newCount := chunkList.Snapshot()

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 349–350why, one step back
349 // We want to avoid showing empty list when reload is triggered
350 // and the query string is changed at the same time i.e. command != nil && changed

Fix reload and reload-sync behaviorsJunegunn Choibefore adoption008fb9d

lines 351–354why, one step back
351 if command == nil || newCount > 0 {
352 if snapshotRevision != inputRevision {353 query = []rune{}354 }

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 355–390why, one step back
355 snapshot = newSnapshot
356 snapshotRevision = inputRevision357 }358 }359 matcher.Reset(snapshot, input(), true, !reading, sort, snapshotRevision)360 delay = false361362 case EvtSearchProgress:363 switch val := value.(type) {364 case float32:365 terminal.UpdateProgress(val)366 }367368 case EvtHeader:369 headerPadded := make([]string, opts.HeaderLines)370 copy(headerPadded, value.([]string))371 terminal.UpdateHeader(headerPadded)372373 case EvtSearchFin:374 switch val := value.(type) {375 case *Merger:376 if deferred {377 count := val.Length()378 if opts.Select1 && count > 1 || opts.Exit0 && !opts.Select1 && count > 0 {379 determine(val.final)380 } else if val.final {381 if opts.Exit0 && count == 0 || opts.Select1 && count == 1 {382 if opts.PrintQuery {383 opts.Printer(opts.Query)384 }385 if len(opts.Expect) > 0 {386 opts.Printer("")387 }388 for i := 0; i < count; i++ {389 opts.Printer(val.Get(i).item.AsString(opts.Ansi))390 }

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 391–392why, one step back
391 if count == 0 {
392 exitCode = ExitNoMatch

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

line 393why, one step back
393 }

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 394–395why, one step back
394 stop = true
395 return

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 396–399why, one step back
396 }
397 determine(val.final)398 }399 }

Remove invalid 'result' event when using --sync optionJunegunn Choibefore adoptiond8bfb67

line 400why, one step back
400 terminal.UpdateList(val, true)

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 401–405why, one step back
401 }
402 }403 }404 events.Clear()405 })

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

lines 406–408why, one step back
406 if stop {
407 break408 }

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

lines 409–415why, one step back
409 if delay && reading {
410 dur := util.DurWithin(411 time.Duration(ticks)*coordinatorDelayStep,412 0, coordinatorDelayMax)413 time.Sleep(dur)414 }415 }

Refactor the code so that fzf can be used as a library (#3769)Junegunn Choibefore adoptione8405f4

line 416why, one step back
416 return exitCode, err

Deploying to master from @ junegunn/fzf@2671259fdb3094a5eac528f291c1fdadbcf9eda9 🚀junegunnbefore adoptiond75bb5c

line 417why, one step back
417}