IngoMeyer441 / simple-term-menu

A Python package which creates simple interactive menus on the command line.
MIT License
505 stars 44 forks source link

Bad tabulation after 9 #38

Open Greenmouse94 opened 3 years ago

Greenmouse94 commented 3 years ago

Hello and thank you for this very good module,

I have an issue when I have a number with 2 digits :

---------------------------------------------------------------------------------------
> [1] Select product                                                                                                                              
  [2] Select engagement                                                                                                                           
  [3] Select test                                                                                                                                 
  [4] Show finding(s)                                                                                                                             
  [5] See the product                                                                                                                             
  [6] See the engagement                                                                                                                          
  [7] See the test                                                                                                                                
  [8] See the finding                                                                                                                             
  [9] Import a scan                                                                                                                               
      [10]Blabla                                                                                                                                  
  [x] Exit 

As you can see the 10th number has a bad tabulation.

Best regards.

IngoMeyer441 commented 3 years ago

Thanks for your bug report. I can confirm the described behavior. I never tested using two keys because pressing one key already selects an entry. So currently, in this case, pressing 1 would always select the first entry. The 10th entry cannot be selected with a shortcut. So how would you like to use this feature? Perhaps, the menu should wait for more key presses if the selection is ambiguous.

majezt1c commented 3 years ago

I also wanted my menu to work this way, and encountered the same issue. One solution I thought back in the day was to add a little delay or wait that the menu could use "to buffer" user's input, if that makes any sense.

Midnex commented 2 years ago

Default selection is Next page at bottom. Shortcuts are defined as 0-9, or A-J (user definable?) Users then would press P or N to cycle forward or backward through the pages. Each shortcut would correlate with the page it is on, not the entire list.

Other shortcuts could be Shift-Enter/P for previous page Enter/N for next page

allenweiss commented 1 year ago

Has this tabulation problem (once you get past nine objects there are extra spaces) been solved? I know about shortcuts; I just thought there would be a way to correct the extra spaces before the 10th and subsequent options.