(self, event )
| 453 | # Enter key handler |
| 454 | # |
| 455 | def ProcessEnterEvent(self, event ): |
| 456 | #If autocompletion has been triggered, complete and do not process event |
| 457 | if self.SCIAutoCActive(): |
| 458 | self.SCIAutoCComplete() |
| 459 | self.SCICancel() |
| 460 | return |
| 461 | |
| 462 | self.SCICancel() |
| 463 | # First, check for an error message |
| 464 | haveGrabbedOutput = 0 |
| 465 | if self.HandleSpecialLine(): return 0 |
| 466 | |
| 467 | lineNo = self.LineFromChar() |
| 468 | start, end, isCode = self.GetBlockBoundary(lineNo) |
| 469 | # If we are not in a code block just go to the prompt (or create a new one) |
| 470 | if not isCode: |
| 471 | self.AppendToPrompt([]) |
| 472 | win32ui.SetStatusText(win32ui.LoadString(afxres.AFX_IDS_IDLEMESSAGE)) |
| 473 | return |
| 474 | |
| 475 | lines = self.ExtractCommand((start,end)) |
| 476 | |
| 477 | # If we are in a code-block, but it isnt at the end of the buffer |
| 478 | # then copy it to the end ready for editing and subsequent execution |
| 479 | if end!=self.GetLineCount()-1: |
| 480 | win32ui.SetStatusText('Press ENTER to execute command') |
| 481 | self.AppendToPrompt(lines) |
| 482 | self.SetSel(-2) |
| 483 | return |
| 484 | |
| 485 | # If SHIFT held down, we want new code here and now! |
| 486 | bNeedIndent = win32api.GetKeyState(win32con.VK_SHIFT)<0 or win32api.GetKeyState(win32con.VK_CONTROL)<0 |
| 487 | if bNeedIndent: |
| 488 | self.ReplaceSel("\n") |
| 489 | else: |
| 490 | self.SetSel(-2) |
| 491 | self.ReplaceSel("\n") |
| 492 | source = '\n'.join(lines) |
| 493 | while source and source[-1] in '\t ': |
| 494 | source = source[:-1] |
| 495 | self.OutputGrab() # grab the output for the command exec. |
| 496 | try: |
| 497 | if self.interp.runsource(source, "<interactive input>"): # Need more input! |
| 498 | bNeedIndent = 1 |
| 499 | else: |
| 500 | # If the last line isnt empty, append a newline |
| 501 | if self.history is not None: |
| 502 | self.history.history_store(source) |
| 503 | self.AppendToPrompt([]) |
| 504 | win32ui.SetStatusText(win32ui.LoadString(afxres.AFX_IDS_IDLEMESSAGE)) |
| 505 | # win32ui.SetStatusText('Successfully executed statement') |
| 506 | finally: |
| 507 | self.OutputRelease() |
| 508 | if bNeedIndent: |
| 509 | win32ui.SetStatusText('Ready to continue the command') |
| 510 | # Now attempt correct indentation (should use IDLE?) |
| 511 | curLine = self.DoGetLine(lineNo)[len(sys.ps2):] |
| 512 | pos = 0 |
nothing calls this directly
no test coverage detected