Skip to content

feat(cli/unstable): add visibleLines and indicator options to promptMultpleSelect, and show ... above the options when appropriate#6699

Merged
kt3k merged 11 commits intodenoland:mainfrom
timreichen:promptSelect-add-up-and-down-arrows
Jul 4, 2025
Merged

feat(cli/unstable): add visibleLines and indicator options to promptMultpleSelect, and show ... above the options when appropriate#6699
kt3k merged 11 commits intodenoland:mainfrom
timreichen:promptSelect-add-up-and-down-arrows

Conversation

@timreichen
Copy link
Copy Markdown
Contributor

@timreichen timreichen commented May 30, 2025

After trying the api, ... seems not too intuitive, nothing indicates if there is more content above.
This PR changes the more content indication ... to a arrow and additionally it indicates if moving up is possible with a arrow. It also adds indicator and visibleLines properties to promptMultipleSelect().

What country are you from?
❯ Brazil
  United States
  Japan
  ↓

...

What country are you from?
  ↑
  United States
  Japan
❯ China
  ↓

...

What country are you from?
  ↑
  China
  Canada
❯ Spain

@timreichen timreichen requested a review from kt3k as a code owner May 30, 2025 22:58
@github-actions github-actions Bot added the cli label May 30, 2025
@timreichen timreichen changed the title BREAKING(cli/unstable): replace ... with up and down arrows BREAKING(cli/unstable): replace ... more content indication with up and down arrows May 30, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented May 30, 2025

Codecov Report

Attention: Patch coverage is 96.73913% with 3 lines in your changes missing coverage. Please review.

Project coverage is 94.15%. Comparing base (93d103f) to head (0772d51).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
cli/unstable_prompt_multiple_select.ts 95.58% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6699   +/-   ##
=======================================
  Coverage   94.14%   94.15%           
=======================================
  Files         585      585           
  Lines       42262    42361   +99     
  Branches     6654     6681   +27     
=======================================
+ Hits        39788    39883   +95     
- Misses       2425     2429    +4     
  Partials       49       49           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kt3k
Copy link
Copy Markdown
Contributor

kt3k commented Jun 2, 2025

Is this way of indicating 'more content' common in general? What do other tools do for this situation?

cc @WasixXD

@WasixXD
Copy link
Copy Markdown
Contributor

WasixXD commented Jun 2, 2025

Some tools just loop over (like Inquirer select) and others don't even bother, but I find the arrows a nice fit

@kt3k
Copy link
Copy Markdown
Contributor

kt3k commented Jun 30, 2025

I personally prefer ... for indicating 'more contents' which feels more common to me.

↑ and ↓ in this context feel confusing to me. (I don't remember the use case where ↑ and ↓ indicating 'more contents')

@timreichen
Copy link
Copy Markdown
Contributor Author

I personally prefer ... for indicating 'more contents' which feels more common to me.

↑ and ↓ in this context feel confusing to me. (I don't remember the use case where ↑ and ↓ indicating 'more contents')

The arrows have the additional benefit of not just indicating more contents, but also the location.
... seems fine until one scrolls and content gets out of bounds above, which is not very intuitive to me.

@kt3k
Copy link
Copy Markdown
Contributor

kt3k commented Jul 2, 2025

The arrows have the additional benefit of not just indicating more contents, but also the location. ... seems fine until one scrolls and content gets out of bounds above, which is not very intuitive to me.

I think that situation can be covered by showing ... above.

@kt3k kt3k changed the title BREAKING(cli/unstable): replace ... more content indication with up and down arrows feat(cli/unstable): add visibleLines and indicator options to promptMultpleSelect, and show ... above the options when appropriate Jul 4, 2025
Copy link
Copy Markdown
Contributor

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed this nicely wraps the options. LGTM

@kt3k
Copy link
Copy Markdown
Contributor

kt3k commented Jul 4, 2025

Added some examples to demonstrate both patterns (full and partial) of displaying options

@kt3k kt3k merged commit b3c3b2f into denoland:main Jul 4, 2025
19 checks passed
BlackAsLight pushed a commit to BlackAsLight/std that referenced this pull request Jul 11, 2025
…omptMultpleSelect`, and show `...` above the options when appropriate (denoland#6699)
BlackAsLight pushed a commit to BlackAsLight/std that referenced this pull request Jul 11, 2025
…omptMultpleSelect`, and show `...` above the options when appropriate (denoland#6699)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants