tty-prompt icon indicating copy to clipboard operation
tty-prompt copied to clipboard

multi_select: pressing ctrl_a or ctrl_r on filtered results, raises an exception

Open bill-kolokithas opened this issue 2 years ago • 0 comments

Describe the problem

Pressing ctrl+a or ctrl+r on filtered results, raises an exception.

Steps to reproduce the problem

Create a multi_select with the filter: true option enabled

TTY::Prompt.new.multi_select('multi', ['a', 'b'], filter: true)
multi
‣ ⬡ a
  ⬡ b

Type something to filter the results

TTY::Prompt.new.multi_select('multi', ['a', 'b'], filter: true)
multi (Filter: "a")
‣ ⬡ a

press ctrl+a

Traceback (most recent call last):
       16: from /home/billk/code/tty-prompt/lib/tty/prompt.rb:249:in `invoke_select'
       15: from /home/billk/code/tty-prompt/lib/tty/prompt/list.rb:244:in `call'
       14: from /home/billk/.gem/ruby/2.5.0/gems/tty-reader-0.9.0/lib/tty/reader.rb:118:in `subscribe'
       13: from /home/billk/code/tty-prompt/lib/tty/prompt/list.rb:245:in `block in call'
       12: from /home/billk/code/tty-prompt/lib/tty/prompt/list.rb:454:in `render'
       11: from /home/billk/.gem/ruby/2.5.0/gems/tty-reader-0.9.0/lib/tty/reader.rb:190:in `read_keypress'
       10: from /home/billk/.gem/ruby/2.5.0/gems/tty-reader-0.9.0/lib/tty/reader.rb:476:in `trigger_key_event'
        9: from /home/billk/.gem/ruby/2.5.0/gems/tty-reader-0.9.0/lib/tty/reader.rb:422:in `trigger'
        8: from /home/billk/.gem/ruby/2.5.0/gems/wisper-2.0.1/lib/wisper/publisher.rb:42:in `broadcast'
        7: from /usr/lib/ruby/2.5.0/set.rb:338:in `each'
        6: from /usr/lib/ruby/2.5.0/set.rb:338:in `each_key'
        5: from /home/billk/.gem/ruby/2.5.0/gems/wisper-2.0.1/lib/wisper/publisher.rb:43:in `block in broadcast'
        4: from /home/billk/.gem/ruby/2.5.0/gems/wisper-2.0.1/lib/wisper/registration/object.rb:18:in `broadcast'
        3: from /home/billk/.gem/ruby/2.5.0/gems/wisper-2.0.1/lib/wisper/broadcasters/send_broadcaster.rb:5:in `broadcast'
        2: from /home/billk/.gem/ruby/2.5.0/gems/wisper-2.0.1/lib/wisper/broadcasters/send_broadcaster.rb:5:in `public_send'
        1: from /home/billk/code/tty-prompt/lib/tty/prompt/multi_list.rb:74:in `keyctrl_a'
NoMethodError (undefined method `enabled' for #<Array:0x0000562dd3058910>)
  • OS version: Debian 10 (buster)
  • Ruby version: ruby 2.5.5p157
  • TTY::Prompt version: v0.23.1

Additional info

There is no tagged version with the above feature working. The ctrl+a feature was added in this commit: https://github.com/piotrmurach/tty-prompt/commit/17bd772731073a6537a This commit broke the feature https://github.com/piotrmurach/tty-prompt/commit/a7713c6d912e65d202

bill-kolokithas avatar Mar 10 '22 20:03 bill-kolokithas