Copy selected lines to the clipboard, with prompts. This makes the copied text useful for doc-tests and interactive shell code examples. This always copies entire lines, even if only part of the first and/or last lines is selected.
(self, event=None)
| 1003 | |
| 1004 | |
| 1005 | def copy_with_prompts_callback(self, event=None): |
| 1006 | """Copy selected lines to the clipboard, with prompts. |
| 1007 | |
| 1008 | This makes the copied text useful for doc-tests and interactive |
| 1009 | shell code examples. |
| 1010 | |
| 1011 | This always copies entire lines, even if only part of the first |
| 1012 | and/or last lines is selected. |
| 1013 | """ |
| 1014 | text = self.text |
| 1015 | selfirst = text.index('sel.first linestart') |
| 1016 | if selfirst is None: # Should not be possible. |
| 1017 | return # No selection, do nothing. |
| 1018 | sellast = text.index('sel.last') |
| 1019 | if sellast[-1] != '0': |
| 1020 | sellast = text.index("sel.last+1line linestart") |
| 1021 | text.clipboard_clear() |
| 1022 | prompt_text = self.get_prompt_text(selfirst, sellast) |
| 1023 | text.clipboard_append(prompt_text) |
| 1024 | |
| 1025 | reading = False |
| 1026 | executing = False |
nothing calls this directly
no test coverage detected