Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSuper Paste #382
Super Paste #382
Comments
|
Would also be cool if this allowed too-indented code to be run. |
|
Sounds good to me. We differ in details from the interactive (C)Python interpreter anyway (e.g. auto indentation), hence that should not be a big deal. |
|
Cool! I guess this should be implemented either as 1) an extra parse step for paste messages, or 2) when a keypress in a paste event triggers a return, maybe make it an indented return if there are more indented lines later in the paste event. |
|
Similarly, bringing in
from the external editor should work as well. Maybe going along with detection of syntax error? Get a block of text, and
|
|
I've merged the first half of this into master: extra blank lines are no longer a problem! We need more tests for this. The second half should be pretty easy - it something has an error, splitting it into two blocks by adding a line. If still an error, abandon. |
|
See the add-remove-lines branch for more |
|
I'm feeling less good about this code, and thinking about removing it. It should at least be improved. |
|
I just got a paste bug with this code, it should be ripped out and something more comprehensive and carefully tested used instead. |
|
I removed the old code and replaced it with something simpler: lines that are blank will be indented to prevent running a partial command. |
|
What's the best way to test this? |
|
Right now there's |
|
The scope of this issue should be defined. I think any syntactically correct Python code should be able to round-trip from an editor and back, possibly with some whitespace differences like blank lines that contain only whitespace becoming empty lines. For now, we can limit this to pastes that begin on empty lines. |
|
Not a bug anymore, it either works or gives up and the paste doesn't work. |
|
What works currently:
What doesn't work:
Also multiline pastes onto lines already containing text are not tested. |
|
If anyone works on this, check out the currently skipped tests in the |
It would be cool to be able to paste in code from a file that has newlines in places that could complete a command, but based on input a few lines down, probably doesn't:
if we could do this in a way that didn't differ from python too much. This would be a change in behavior from the normal interpreter, I want to clear it with folks first. Thoughts, @ikanobori @Trundle @sebastinas @bobf ?