New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pry.line_buffer doesn't show last line #830

Open
ngty opened this Issue Jan 27, 2013 · 5 comments

Comments

Projects
None yet
4 participants
@ngty

ngty commented Jan 27, 2013

Pry.line_buffer doesn't show the last line, here's a quick example:

[1] pry(main)> def show_last_line; puts Pry.line_buffer[-1]; end
=> nil
[2] pry(main)> show_last_line
def show_last_line; puts Pry.line_buffer[-1]; end
=> nil

While Pry.history does so:

[1] pry(main)> def show_last_line; puts Pry.history.to_a[-1]; end
=> nil
[2] pry(main)> show_last_line
show_last_line
=> nil
@kyrylo

This comment has been minimized.

Member

kyrylo commented Jan 27, 2013

This is a bit tricky. @rf- explained that the line you're entering is in return value (the array), but you won't notice it during the evaluation (when you print it).

@kyrylo kyrylo closed this Jan 27, 2013

@banister banister reopened this Jan 27, 2013

@banister

This comment has been minimized.

Member

banister commented Jan 27, 2013

@kyrylo i'm guessing you closed it by accident :)

@kyrylo

This comment has been minimized.

Member

kyrylo commented Jan 27, 2013

Whoops! I'm really bad at hitting "Comment" button today. :-)
Failed the second time.

@ngty

This comment has been minimized.

ngty commented Jan 28, 2013

@kyrylo Noted. Just thought that it isn't the expected behaviour. At the moment, i'm able to construct lines in the current session reliably (i hope) with:

[Pry.line_bugger, Pry.history.to_a[-1]].flatten
@rf-

This comment has been minimized.

Member

rf- commented Jan 28, 2013

In theory I don't see any reason we couldn't push the entered line into line_buffer before evaling it. I tried it out and it broke some tests, though, so either there's some fundamental reason it's a bad idea or we just need to update the tests.

@rf- rf- added the feature label Apr 29, 2014

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