( state: AutoCompleteState, options: AutoCompleteOptionsReq<A>, figures: Effect.Success<typeof platformFigures>, renderOptions?: RenderOptions | undefined )
| 3223 | } |
| 3224 | |
| 3225 | const renderAutoCompleteChoices = <A>( |
| 3226 | state: AutoCompleteState, |
| 3227 | options: AutoCompleteOptionsReq<A>, |
| 3228 | figures: Effect.Success<typeof platformFigures>, |
| 3229 | renderOptions?: RenderOptions | undefined |
| 3230 | ) => { |
| 3231 | if (state.filtered.length === 0) { |
| 3232 | return renderOptions?.plain === true |
| 3233 | ? options.emptyMessage |
| 3234 | : Ansi.annotate(options.emptyMessage, Ansi.blackBright) |
| 3235 | } |
| 3236 | const cursor = autoCompleteCursor(state) |
| 3237 | const toDisplay = entriesToDisplay(cursor, state.filtered.length, options.maxPerPage) |
| 3238 | const documents: Array<string> = [] |
| 3239 | for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) { |
| 3240 | const choiceIndex = state.filtered[index] |
| 3241 | const choice = options.choices[choiceIndex] |
| 3242 | const isSelected = state.index === choiceIndex |
| 3243 | const prefix = renderAutoCompleteChoicePrefix(state, options, toDisplay, index, figures, renderOptions) |
| 3244 | const title = renderChoiceTitle(choice, isSelected, renderOptions) |
| 3245 | const description = renderChoiceDescription(choice, isSelected, renderOptions) |
| 3246 | documents.push(prefix + title + " " + description) |
| 3247 | } |
| 3248 | return documents.join("\n") |
| 3249 | } |
| 3250 | |
| 3251 | const renderSelectNextFrame = Effect.fnUntraced(function*<A>(state: SelectState, options: SelectOptionsReq<A>) { |
| 3252 | const figures = yield* platformFigures |
no test coverage detected