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

Allow pasting multiple lines in the Python Console (#9776) #9781

merged 1 commit into from Jul 1, 2019


None yet
5 participants
Copy link

commented Jun 21, 2019

Link to issue number:

Fixes #9776

Summary of the issue:

It is currently impossible to paste more than one line in the python console. It would be handy if this could be possible, as it will make copying and testing code from the console easier.

Description of how this pull request fixes the issue:

Like on the standard Python Console, the input field remains single-line.
However, when pasting multiple lines from the clipboard, these are executed sequentially like if typed one by one.
Care is taken to consider the text already present in the input field and the position of the cursor to obtain the same result as pasting in a multi-line field.
Unlike on the standard Python Console, if a compilation error occurs on one line, pasting of the remaining lines stops to avoid execution of the remaining lines and ease reading of output error. In such a case, the original input text after the cursor is restored in the input field.
Nevertheless, as one would expect, pasting of multiple lines does not stop if the execution itself raises an exception.

Testing performed:

Ported from an add-on in use for a few months.
Probably better to further test live, though.

Known issues with pull request:

Change log entry:

In the Python Console, the input field now supports pasting multiple lines from the clipboard.

@leonardder leonardder requested review from leonardder and feerrenrut Jun 21, 2019

Copy link

left a comment

This works as expected and is very well written, thank you!
I think the code is good as is, though I have one suggestion below.

Show resolved Hide resolved source/ Outdated
Show resolved Hide resolved source/ Outdated

JulienCochuyt added a commit to accessolutions/nvda that referenced this pull request Jun 21, 2019

@JulienCochuyt JulienCochuyt force-pushed the accessolutions:i9776 branch from c157a1d to 8dc77b7 Jun 24, 2019

Copy link

left a comment

There are now conflicts with master due to the merging of some of your other prs for the python console.

@JulienCochuyt JulienCochuyt force-pushed the accessolutions:i9776 branch from 8dc77b7 to 983ea80 Jun 26, 2019


This comment has been minimized.

Copy link
Contributor Author

commented Jun 26, 2019

Rebased onto the latest master. Thank you for the merging of the other PRs.

The PR has been rebased, it no longer conflicts.

@feerrenrut feerrenrut merged commit 80acce2 into nvaccess:master Jul 1, 2019

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded

@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Jul 1, 2019

feerrenrut added a commit that referenced this pull request Jul 1, 2019

@JulienCochuyt JulienCochuyt deleted the accessolutions:i9776 branch Jul 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.