Repository navigation
Conversation
|
This PR is stale because it has been open for 30 days with no activity. |
|
|
||
| def cut(self,event): | ||
| if not self.text.tag_ranges('sel'): | ||
| self.text.tag_add('sel', 'insert linestart', 'insert+1l linestart') |
There was a problem hiding this comment.
Would this work with multiple empty lines between 2 meaningful lines?
[and same comment for the copy action]
There was a problem hiding this comment.
If the cursor is on an empty line, after my patch, pressing Ctrl-C will copy this empty line, so it is '\n'.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Thank you. Moving the cursor to the start of the line is right (Ctrl-C Ctrl-V then duplicates the line), but the line must not be selected: after this patch the next typed character replaces the whole line. Put the line on the clipboard directly instead of selecting it: text.clipboard_clear(); text.clipboard_append(text.get('insert linestart', 'insert+1line linestart')). For cut, do the same and then delete the line with text.delete().
Please also add a test in idle_test/test_editor.py (clipboard content, no selection, cursor at the line start, line deleted for cut) and update the Cut and Copy entries in Doc/library/idle.rst.
Ctrl-C in the Shell still interrupts, since the interrupt binding runs first when there is no selection.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Why can't this line be selected? After pressing Ctrl-C, the line will be selected and copied. Isn't it more intuitive for users to know that the copied part is the selected line? This is just my opinion, and I wanted to discuss it with you. I’ll complete the test case after a while. |
|
If it remains selected after copying, then pressing any character key will remove it. Pressing Ctrl-V will replace it with itself, which is less useful than duplicating. |
|
I may not accept the issue, but have spent my time on many other issues. |
17db7cd to
b930b29
Compare
|
@serhiy-storchaka I have made the requested changes; please review again |
|
Thanks for making the requested changes! @serhiy-storchaka: please review the changes made to this pull request. |
When the selection is empty, pressing Ctrl-C/Ctrl-X would copy text of zero length, which seems make no sense, and probably cause mistakes (e.g. forgot copy a zero-length text). Therefore, I modified the behavior to copy the current line when there is no selection, which supported by some other editors.