pry icon indicating copy to clipboard operation
pry copied to clipboard

Pasting more than x lines of hash breaks pry

Open MaicolBen opened this issue 6 years ago • 8 comments

So If I paste the next code:

customer = {
  name: "John Doe",
  email: "[email protected]",
  address: {
    street1: "123 account st",
    street2: "",
    city: "los angeles",
    state: "CA",
    postal_code: "12345",
    country: "USA"
  },
  address1: {
    street1: "123 account st",
    street2: "",
    city: "los angeles",
    state: "CA",
    postal_code: "12345",
    country: "USA"
  },
  address2: {
    street1: "123 account st",
    street2: "",
    city: "los angeles",
    state: "CA",
    postal_code: "12345",
    country: "USA"
  },
  address3: {
    street1: "123 account st",
    street2: "",
    city: "los angeles",
    state: "CA",
    postal_code: "12345",
    country: "USA"
  },
  address4: {
    street1: "123 account st",
    street2: "",
    city: "los angeles",
    state: "CA",
    postal_code: "12345",
    country: "USA"
  },
  address5: {
    street1: "123 account st",
    street2: "",
    city: "los angeles",
    state: "CA",
    postal_code: "12345",
    country: "USA"
  },
  address6: {
    street1: "123 account st",
    street2: "",
    city: "los angeles",
    state: "CA",
  }
}

It breaks pry because it cannot find the end of the hash, it doesn't depend on the amount of lines, it depends on the amount of chars. This doesn't hapen with irb

I have ruby 2.4.4, pry 0.11.3

MaicolBen avatar Aug 08 '18 20:08 MaicolBen

It appears to be due to our syntax "correct indent" code, which irb doesn't have

try typing this in pry before you paste _pry_.config.correct_indent = false

banister avatar Aug 08 '18 21:08 banister

thanks, but that didn't work

MaicolBen avatar Aug 08 '18 21:08 MaicolBen

Hmm really?

Try this then:

_pry_.config.auto_indent = false

and then pasting :)

banister avatar Aug 08 '18 21:08 banister

that worked, but I can't put this config for just this case, should I close this issue? I think it should be fixed, but that's my opinion

MaicolBen avatar Aug 10 '18 18:08 MaicolBen

Got similar situation, but I was not pasting hash keys but nearly 70 lines of code, the cmd window (win7,ruby2.5.1,msys2) just hang, I can ctrl+c but the pry won't respond to any other keys afterwards.
If I copy within 20lines or so, it's okay.

Btw, Is there a way to load an rb file and keep the environment created by the rb file after the rb file excuting finished?(like python's execfile) -- Or, if I can specify which lines to load in to pry environment, that's even better.
Thanks :)

ghost avatar Aug 17 '18 17:08 ghost

I can reproduce this only when I use tmux. This is a valid bug, and a very annoying one :)

kyrylo avatar Nov 04 '18 07:11 kyrylo

Indeed. I had to switch to irb today. :)

vfonic avatar May 08 '19 16:05 vfonic

Yep, I try pasting smaller chunks of code, until this is resolved.

None of this helps:

_pry_.config.correct_indent = false
_pry_.config.auto_indent = false

🔴

januszm avatar Apr 08 '20 19:04 januszm