Show clicked context line at top of editor. If a selection was made, don't jump; allow copying. If no visible context, show the top line of the file.
(self, event=None)
| 217 | self.context['state'] = 'disabled' |
| 218 | |
| 219 | def jumptoline(self, event=None): |
| 220 | """ Show clicked context line at top of editor. |
| 221 | |
| 222 | If a selection was made, don't jump; allow copying. |
| 223 | If no visible context, show the top line of the file. |
| 224 | """ |
| 225 | try: |
| 226 | self.context.index("sel.first") |
| 227 | except TclError: |
| 228 | lines = len(self.info) |
| 229 | if lines == 1: # No context lines are showing. |
| 230 | newtop = 1 |
| 231 | else: |
| 232 | # Line number clicked. |
| 233 | contextline = int(float(self.context.index('insert'))) |
| 234 | # Lines not displayed due to maxlines. |
| 235 | offset = max(1, lines - self.context_depth) - 1 |
| 236 | newtop = self.info[offset + contextline][0] |
| 237 | self.text.yview(f'{newtop}.0') |
| 238 | self.update_code_context() |
| 239 | |
| 240 | def timer_event(self): |
| 241 | "Event on editor text widget triggered every UPDATEINTERVAL ms." |
nothing calls this directly
no test coverage detected