Closed johanrosenkilde closed 7 years ago
Thanks for reporting and improving sage-shell-mode
.
I confirmed this bug and will fix it. But I cannot completely fix it at the moment. This is due to an issue of IPython. We cannot turn off the auto indentation and it breaks the indentation when pasting code, even if I fix sage-shell-mode
.
I'm asking naively now: isn't it sage-shell-mode
that's sending code to the IPython process? So sage-shell-mode
should be able to catch the pasted code, break it up into lines, and send each line to the IPython process?
So sage-shell-mode should be able to catch the pasted code, break it up into lines, and send each line to the IPython process?
If you evaluate the following code in a Sage shell buffer, you will see an indentation error.
(process-send-string (get-buffer-process sage-shell:process-buffer)
"def foo(x):
if x == 1:
return 1
elif x%2 == 0:
if x == 0:
return 0
else:
return 1
else:
return x")
It may work if the leading white spaces are stripped from each lines. But auto indentation may not be correct always.
Yeah ok, I see the problem . I don't see how IPython's current semantics of trying to help with indentation is usable in any circumstance :-S
I have fixed this issue in master using %cpaste
. Thanks for reporting.
Awesome, thanks!
I'm having trouble pasting (yanking) multiple lines of code into a Sage 7.4.beta3 process with
use-prompt-toolkit
set tot
.The pasted code appears but when pressing ENT, it disappears again and no code was evaluated.