Allow pasting multiple lines in the Python Console (#9776)#9781
Merged
Conversation
LeonarddeR
approved these changes
Jun 21, 2019
LeonarddeR
left a comment
Collaborator
There was a problem hiding this 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.
JulienCochuyt
added a commit
to accessolutions/nvda
that referenced
this pull request
Jun 21, 2019
Suggested change as of nvaccess#9781 (comment)
michaelDCurran
approved these changes
Jun 25, 2019
michaelDCurran
previously requested changes
Jun 25, 2019
michaelDCurran
left a comment
Member
There was a problem hiding this comment.
There are now conflicts with master due to the merging of some of your other prs for the python console.
Contributor
Author
|
Rebased onto the latest master. Thank you for the merging of the other PRs. |
feerrenrut
approved these changes
Jul 1, 2019
The PR has been rebased, it no longer conflicts.
feerrenrut
added a commit
that referenced
this pull request
Jul 1, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.