nonsequitur / inf-ruby

218 stars 69 forks source link

Custom prompt prevents history navigation #72

Closed topalovic closed 9 years ago

topalovic commented 9 years ago

Hello.

When running pry with a custom prompt and trying to navigate (M-p, M-n) or search my input history (M-r), I get the following error:

Search failed: "\\(^>> *\\)\\|\\(^(rdb:1) *\\)\\|\\(^(byebug) *\\)\\|\\(^\\(irb([^)]+)\\|\\([[0-9]+] \\)?[Pp]ry ?([^)]+)\\|\\(jruby-\\|JRUBY-\\)?[1-9]\\.[0-9]\\.[0-9]+\\(-?p?[0-9]+\\)?\\|^rbx-head\\) ?[0-9:]* ?> *\\)"

To reproduce, try adding this to your .pryrc:

Pry.config.prompt_name = "test"

I'm usually setting it to File.basename(Dir.pwd) in order to easily differentiate between projects, but it seems that anything other than the default prompt will result in Search failed.

dgutov commented 9 years ago

Maybe you should update the values of inf-ruby-first-prompt-pattern and inf-ruby-prompt-pattern accordingly.

topalovic commented 9 years ago

@dgutov Thanks for the pointer. I simplified the original pattern down to "\\([[0-9]+] \\)?.*([^)]+)" and it seems to cover all of my bases.

dgutov commented 9 years ago

@topalovic Cool.