Skip to content
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

REPL :edit command bad interaction with certain useful editors #7682

Closed
scabug opened this issue Jul 21, 2013 · 11 comments
Closed

REPL :edit command bad interaction with certain useful editors #7682

scabug opened this issue Jul 21, 2013 · 11 comments

Comments

@scabug
Copy link

scabug commented Jul 21, 2013

The new :edit command doesn't like console editors, as foretold.

We will repair this usability deficit.

@scabug
Copy link
Author

scabug commented Jul 21, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7682?orig=1
Reporter: @sschaef
Affected Versions: 2.11.0

@scabug
Copy link
Author

scabug commented Jul 21, 2013

@som-snytt said:
I'll need some info, since the use case was just to default to :line behavior, which is to put the lines at the end of history so at least you can up-arrow to them.

1441  val i = 8
1442  :hi

scala> :ed 1441-
Placing text in recent history.

scala> :hi
[snip]
1441  val i = 8
1442  :hi
1443  :ed 1441-
1444  val i = 8
1445  :hi

scala> :q
apm@mara:~/tmp$ echo $EDITOR

apm@mara:~/tmp$ 

Maybe the EDITOR isn't actually unset, but is garbage? etc.

@scabug
Copy link
Author

scabug commented Jul 21, 2013

@sschaef said:
DAMN, yes EDITOR was not unset. It pointed to vim which couldn't be loaded. After I unset the variable everything works fine.

I'll close the ticket but if you want you can take a look at the exception that occurs when EDITOR points to an editor that does not exist:

java.io.IOException: Cannot run program "": error=2, No such file or directory

@scabug
Copy link
Author

scabug commented Jul 22, 2013

@som-snytt said:
I'll use this ticket for the promised follow-up.

@scabug
Copy link
Author

scabug commented Jul 22, 2013

@som-snytt said:
I believe "bad interaction" is the current nomenclature, is it not?

"Interacts badly," "Does not play well with others."

@scabug
Copy link
Author

scabug commented Feb 9, 2015

@michaelpigg said:
I was so excited to stumble on the :edit command, and then so confused when it just hung the REPL (with EDITOR=vim).

@scabug scabug added the repl label Apr 7, 2017
@scabug scabug added this to the Backlog milestone Apr 7, 2017
@SethTisue
Copy link
Member

not sure what the cause is, but "good first issue" seems at least plausible. at least to figure out what's going on.

@mado-m
Copy link

mado-m commented Jun 27, 2019

Now, without EDITOR, it behaves the same as:line.
It freezes when I set vim to EDITOR.

If set vim, is it correct behavior that editable history with vim?

@SethTisue
Copy link
Member

If set vim, is it correct behavior that editable history with vim?

That's the goal, yes.

@nogurenn
Copy link

nogurenn commented May 22, 2020

I don't see the :edit command in 2.12 and 2.13, so I think it's temporary until this is fixed. This is what I got.

$ EDITOR=""
==> java.io.IOException: Cannot run program "": error=2, No such file or directory
// says at the tail that the entry has slain the compiler (If I choose replay,
"Nothing to replay.")

$ EDITOR="vim"
==> 
// blank, cannot type anything, but it might actually be running and didn't hang up
// $ ps says
// 54175 ttys001    0:00.01 vim /var/folders/3z/vxd....
// and pressing ctrl-c in the scala console removes the vim process.

$ EDITOR="nano"
==> Error exit from nano (1), ignoring
// reaches the default case x for pr.exitCode

$ EDITOR="code" // visual studio code
==> 
    +vim
    +:ed
    +val x = 123
    +:hi
    +:ed 184-
    +:hi
    ....
    <console>:5: error: ';' expected but ':' found.
    :ed 184-
    ^
    <console>:12: error: ';' expected but ':' found.
    :ed 184-
    ^

    scala> 
// prints the stuff above, and then opens my vscode app with a blank .tmp file
// it reaches the next input (?) as seen in the last line above
// visually, it happens in that order. I ran :edit with the app open already.
// I don't have proof that it does happen in that order though

screenshot of open vscode app after running :ed
Screen Shot 2020-05-23 at 2 23 18 AM

@som-snytt
Copy link

The feature was just a quick workaround for JLine2 limitations. It allowed using gedit to edit multiple lines of history.

Closing in favor of upstream contributions to JLine3, as necessary.

@SethTisue SethTisue modified the milestones: Backlog, 2.13.2 May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants