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 :paste mode problem for 2.11.* versions has issues not seen with previous #9221

Closed
scabug opened this issue Mar 13, 2015 · 11 comments
Closed

Comments

@scabug
Copy link

scabug commented Mar 13, 2015

% ./scala
Welcome to Scala version 2.11.2 (OpenJDK 64-Bit Server VM, Java 1.7.0_75).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :paste
// Entering paste mode (ctrl-D to finish)
var a = 3


Control-D does nothing to leave this environment.

No problems exist for 2.10.* nor 2.9.*

@scabug
Copy link
Author

scabug commented Mar 13, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9221?orig=1
Reporter: Jimi Damon (purplefishies)
Affected Versions: 2.11.0, 2.11.2

@scabug
Copy link
Author

scabug commented Mar 13, 2015

@som-snytt said:
There should be blank line after "// Entering paste mode". Is there?

It's conceivable that JLine version in 2.11 is using a setting in your environment. Some research required.

@scabug
Copy link
Author

scabug commented Mar 13, 2015

Jimi Damon (purplefishies) said:
Yes, that is correct. There is a space after "// Entering paste mode".

I can go looking for possible jline issues.

@scabug
Copy link
Author

scabug commented Nov 1, 2016

@som-snytt said:
Fair to say this is not reproducible without more info.

@scabug
Copy link
Author

scabug commented Nov 1, 2016

Jimi Damon (purplefishies) said:
jline has no version information in Scala 2.10 ...etc

jline with 2.11 is around 2.12.1

@scabug
Copy link
Author

scabug commented Nov 1, 2016

Jimi Damon (purplefishies) said:
In addition,

switching the jline version has No effect on scala's paste mode not working

I tried 2.10 version of scala with 2.12.1 version of jline and paste worked just fine.

@scabug
Copy link
Author

scabug commented Nov 1, 2016

@som-snytt said:
Any .inputrc or jline.inputrc?

@scabug
Copy link
Author

scabug commented Nov 1, 2016

Jimi Damon (purplefishies) said (edited by @som-snytt on Nov 1, 2016 8:27:52 PM UTC):
.inputrc corrected

set bind-tty-special-chars off

"\C-h": backward-delete-char
"\C-?": backward-delete-char
"\C-x\C-?": backward-kill-line
"\C-b": backward-kill-word
"\C-f": backward-word
"\M-b": backward-word
"\C-a": beginning-of-line
"\C-xe": call-last-kbd-macro
"\M-c": capitalize-word
"\C-xu": capitalize-word
"\C-]": character-search

$if 
"\C-[": backward-character-search
"\M-g": glob-complete-word
"\C-x*": glob-expand-word
"\C-xg": glob-list-expansions
"\M-^": history-expand-line
"\M-.": insert-last-argument
"\M-_": insert-last-argument
"\C-o": operate-and-get-next
"\C-x!": possible-command-completions
"\C-x/": possible-filename-completions
"\C-x@": possible-hostname-completions
"\C-x~": possible-username-completions
"\C-x$": complete-variable
"\M-\C-e": shell-expand-line
$endif

"\C-l": clear-screen
"\C-i": complete
"\C-d": delete-char
"\C-r": reverse-search-history
"\C-s": forward-search-history
"\C-g": forward-word
"\M-f": forward-word





# history-search-backward (not bound)
# history-search-forward (not bound)
"\M-#": insert-comment
"\M-*": insert-completions

"\C-k": kill-line
"\C-w": kill-region
# kill-whole-line (not bound)
"\C-n": kill-word
"\M-d": kill-word
# magic-space (not bound)
# menu-complete (not bound)
"\M-OB": next-history
"\M-[B": next-history
"\M-n": non-incremental-forward-search-history
# non-incremental-forward-search-history-again (not bound)
"\M-p": non-incremental-reverse-search-history
# non-incremental-reverse-search-history-again (not bound)

# overwrite-mode (not bound)
# paste-from-clipboard (not bound)

"\M-=": possible-completions
"\M-?": possible-completions




"\C-p": previous-history
"\M-OA": previous-history
"\M-[A": previous-history
"\C-q": quoted-insert
"\C-v": quoted-insert
"\C-x\C-r": re-read-init-file
# redraw-current-line (not bound)

"\M-\C-r": revert-line
"\M-r": revert-line
"\C-@": set-mark

"\C-x(": start-kbd-macro
# tab-insert (not bound)
"\M-&": tilde-expand
"\C-t": transpose-chars
"\M-t": transpose-words
# tty-status (not bound)
"\C-x\C-u": undo
"\C-_": undo
# universal-argument (not bound)
"\C-u": unix-line-discard
# unix-word-rubout (not bound)
"\M-u": upcase-word
"\C-y": yank
"\M-.": yank-last-arg
"\M-_": yank-last-arg
"\M-\C-y": yank-nth-arg
"\M-y": yank-pop

$if bsh
"\C-xe": rlwrap-call-editor
$endif


set bell-style none 

@scabug
Copy link
Author

scabug commented Nov 1, 2016

Jimi Damon (purplefishies) said:
This auto formatting is messing up the .inputrc

@scabug
Copy link
Author

scabug commented Nov 1, 2016

@som-snytt said (edited on Nov 2, 2016 12:33:51 AM UTC):
OK, yes, that config breaks ctl-D. I'll take a look at what's going on. (OK, I see there's a mapping for ctl-D. Maybe REPL can test for that or subvert it when pasting. Actually readline doc says it should take ctl-D as EOF at beginning of empty line. There is noise at JLine2/3 around this issue.)

Meanwhile, the workaround is to use here doc syntax:

$ scala
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_101).
Type in expressions for evaluation. Or try :help.

scala> :pa << DONE
// Entering paste mode (DONE to finish)

val i = 42
DONE

// Exiting paste mode, now interpreting.

i: Int = 42

scala> 

I think it's fair to say, I had the last laugh on here doc syntax. Or, maybe every dumb idea looks smart once.

@som-snytt
Copy link

Closing as out of scope with a workaround.

@SethTisue SethTisue removed this from the Backlog milestone Nov 27, 2018
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

3 participants