Skip to content

Commit

Permalink
Show cursor after input line
Browse files Browse the repository at this point in the history
  • Loading branch information
mokkabonna committed Sep 29, 2023
1 parent 81d0cd3 commit 5652580
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/inquirer-autocomplete-standalone/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default createPrompt(
<Value extends unknown>(
config: AutocompleteConfig<Value>,
done: (value: Value) => void
): string => {
): string | [string, string] => {
config.suggestOnly ??= false;
const [searchStatus, setSearchStatus] = useState<AsyncStatus>(
AsyncStatus.Pending
Expand Down Expand Up @@ -298,13 +298,14 @@ export default createPrompt(

let formattedValue = transformMaybe(input);

function renderPrompt(extra: string, ...rest: string[]) {
function renderPrompt(
extra: string,
...rest: string[]
): string | [string, string] {
const firstLine = `${prefix} ${message} ${extra}`;

const below = rest.join('');
const results = below ? `\n${below}` : '';

return `${firstLine}${results}${ansiEscapes.cursorHide}`;
return [`${firstLine}`, `${below}`];
}

if (finalValue !== null) {
Expand Down

0 comments on commit 5652580

Please sign in to comment.