X Tutup
Skip to content

Fix duplicated multiselect#536

Open
alirezaarzehgar wants to merge 8 commits intopterm:masterfrom
alirezaarzehgar:fix_duplicated-multiselect
Open

Fix duplicated multiselect#536
alirezaarzehgar wants to merge 8 commits intopterm:masterfrom
alirezaarzehgar:fix_duplicated-multiselect

Conversation

@alirezaarzehgar
Copy link
Contributor

@alirezaarzehgar alirezaarzehgar commented Jul 4, 2023

Description

Library can't handle duplicated option names cause it's design is based on checking option names not indexes. This PR change this behavior without breaking backward compatibility.

Scope

What is affected by this pull request?

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Related Issue

Fixes #535

To-Do Checklist

  • I tested my changes
  • I have commented every method that I created/changed
  • I updated the examples to fit with my changes
  • I have added tests for my newly created methods

`InteractiveSelectPrinter.Show()` always returns string and error.
User can't get index of selected option from `Options` array.
In some cases user need duplicated names. Current codebase will not
return good response for duplicated options.
Returning `selectedOption` attribute by another functions keep
backward-compatibility and solve this problem.

Signed-off-by: alireza <alirezaarzehgar82@gmail.com>
In this test code will create a menu of a, b and c strings
then concurrently press key down two times and enter.
Then check `GetSelectedOption` return value with 2.

Signed-off-by: alireza <alirezaarzehgar82@gmail.com>
Signed-off-by: alireza <alirezaarzehgar82@gmail.com>
- Check selectedOption value.
- Simulate human behavior and check result for normal usage.
- Check conflict on simultaneous use of both functions of setting default option.

Signed-off-by: alireza <alirezaarzehgar82@gmail.com>
Signed-off-by: alireza <alirezaarzehgar82@gmail.com>
Signed-off-by: alireza <alirezaarzehgar82@gmail.com>
Signed-off-by: alireza <alirezaarzehgar82@gmail.com>
Signed-off-by: alireza <alirezaarzehgar82@gmail.com>
@codecov
Copy link

codecov bot commented Jul 4, 2023

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 82.61%. Comparing base (bc4dce5) to head (f38f26f).
Report is 165 commits behind head on master.

Files with missing lines Patch % Lines
interactive_multiselect_printer.go 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #536      +/-   ##
==========================================
+ Coverage   82.23%   82.61%   +0.38%     
==========================================
  Files          30       30              
  Lines        3501     3509       +8     
==========================================
+ Hits         2879     2899      +20     
+ Misses        564      558       -6     
+ Partials       58       52       -6     

☔ 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.

@MarvinJWendt
Copy link
Member

Hi @alirezaarzehgar, sorry for the late reply, I was on vacation.
Could you please update this PR, there was a change in the latest release that fixed a bug in select and multiselect on Windows. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Library check and uncheck all of duplicated option names

2 participants

X Tutup