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

Interpreter (aka REPL) history should be by statement, not by textual line. #1067

Open
scabug opened this Issue Jun 25, 2008 · 11 comments

Comments

Projects
None yet
3 participants
@scabug
Copy link

scabug commented Jun 25, 2008

If you write the following in the interpreter:

scala> trait A {
     |   val x : String
     | }
defined trait A

And use up-arrow (or whatever your particular binding is), you get

scala> }

Which is nearly useless. The history should instead group an entire statement. For example, in zsh, if you write:

% for i in *.xml
for> wc -c $$i
8866 build.examples.xml
46544 build.xml

Then hitting up arrow gives you:

% for i in *.xml
wc -c $$i

rlwrap is not smart enough to either, it would probably require more configurability than is reasonable for it to offer, so we should fix the interaction with jline to get the more useful behavior.

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Jun 25, 2008

Imported From: https://issues.scala-lang.org/browse/SI-1067?orig=1
Reporter: Geoffrey Alan Washburn (washburn)

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Jan 14, 2009

@odersky said:
Milestone next_feature deleted

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Dec 14, 2009

@paulp said:
At some point I implemented the logic for this, but the real obstacle is jline. It has enough trouble figuring out where the cursor is under the simplest conditions. Start throwing big multiline blocks into the history and it breaks down in tears. Would love to see this and #2547 addressed by the community.

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Jul 23, 2010

@SethTisue said:
close as wontfix?

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Jul 23, 2010

@paulp said:
I expect to fix this soon too, but it depends on how well the recent jline work goes. I implemented it long ago, and display issues are the impediment.

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Aug 4, 2011

@SethTisue said:
At the time this ticket was created Paul hadn't yet added the :paste feature to the REPL. Now that it exists this ticket is even more relevant.

Stuff pasted into the REPL via :paste probably shouldn't become part of the history when you up-arrow through it. I'm typically pasting 5 or 10 or 20 or 50 lines of code, and it's annoying to have to up-arrow through all that stuff to get to the last expression I actually typed myself with my fingers.

I can imagine this might not be totally trivial to implement since :paste'd code should certainly be considered part of the history for :replay purposes, just not for up-arrow-ing purposes.

I'm adding this as a comment on this ticket, but it isn't strictly the same issue. If fixing JLine not to choke on multiline stuff is too hard, then it would still be very nice to have the "don't up-arrow into pastes" change just by itself.

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Aug 26, 2014

@som-snytt said:
I always wondered what the world was like right after 1066, and now I see that 1067 wasn't so different from today.

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Apr 19, 2015

Li Haoyi (lihaoyi) said:
This has been fixed in the Ammonite REPL.

@ trait A{
    val x: String
  }
defined trait A
@ <UP>
@ trait A{
  val x: String
}
defined trait A
@ <ENTER>
@

It looks kind of awkward sometimes, but it does work

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Jan 27, 2016

Hamish Dickson (hamish.dickson-at-gmail.com) said:
Is this something people are still interested in? I've been looking for something to work on and would be happy to investigate

@Jasper-M

This comment has been minimized.

Copy link
Member

Jasper-M commented May 19, 2017

Dotty has this. Can't we steal it?

@SethTisue

This comment has been minimized.

Copy link
Member

SethTisue commented May 19, 2017

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