REPL, copy/paste and auto indent in julia 0.7

repl

#1

I am referring here to this issue:

It is not only a cosmetic annoyance as it may seem from the screenshots in the issue above.

If you have a large code block, a few hundred lines, the REPL takes very very long to digest what has been pasted into it. It seems that the whitespaces of the already indented pasted code and the auto indent is summing up in a problematic way.

Currently I try to solve this issue in a workaround but I fail with all attempts. I am running the latest julia (0.7-dev from today, windows 10, all 64bit), tried with powershell and cmd. With windows bash, julia does not start:

root@PC:/mnt/c/Windows/System32# /mnt/c/Users/myUserName/AppData/Local/Julia-0.7.0-DEV/bin/julia.exe
ERROR: error initializing stdin in uv_pipe_open: invalid argument (EINVAL -4071)
root@PC:/mnt/c/Windows/System32#

Running cygwin mintty and starting julia from here works fine. So thats for now my workaround.

A solution to the auto indent problem has been comitted:

But some question are still open:

How can I use the new option? Is there a REPL command to switch options on/off? Is it a command line switch?

When I start julia just by double click the installed icon under windows, the default terminal, which is used is CMD, right? Is this possible to change? Or do I have to start the terminal first and run julia in this terminal by entering the path to the julia.exe on the terminals command line?


#2

I will merge this PR. To de-activate the feature, you can put this in your config file:

using REPL

atreplinit() do repl
    if isdefined(repl, :options)
        repl.options = REPL.Options(auto_indent=false)
    end
end

Once the REPL is already running, you can switch the option with Base.active_repl.options.auto_indent = false.


#3

Dang I have got to remember to do this. Currently waiting on a long function to finish pasting…