3691 |
3691 |
3692 pos = self.positionBefore(pos) |
3692 pos = self.positionBefore(pos) |
3693 ch = self.charAt(pos) |
3693 ch = self.charAt(pos) |
3694 |
3694 |
3695 # Don't go past the end of the previous line |
3695 # Don't go past the end of the previous line |
3696 if ch == '\n' or ch == '\r': |
3696 if ch in ('\n', '\r'): |
3697 return "", pos |
3697 return "", pos |
3698 |
3698 |
3699 return ch, pos |
3699 return ch, pos |
3700 |
3700 |
3701 def getSearchText(self, selectionOnly=False): |
3701 def getSearchText(self, selectionOnly=False): |
6381 Public slot to handle the 'Goto syntax error' context menu action. |
6381 Public slot to handle the 'Goto syntax error' context menu action. |
6382 """ |
6382 """ |
6383 seline = self.markerFindNext(0, 1 << self.syntaxerror) |
6383 seline = self.markerFindNext(0, 1 << self.syntaxerror) |
6384 if seline >= 0: |
6384 if seline >= 0: |
6385 index = 0 |
6385 index = 0 |
6386 for handle in self.syntaxerrors.keys(): |
6386 for handle in self.syntaxerrors: |
6387 if self.markerLine(handle) == seline: |
6387 if self.markerLine(handle) == seline: |
6388 index = self.syntaxerrors[handle][0][1] |
6388 index = self.syntaxerrors[handle][0][1] |
6389 self.setCursorPosition(seline, index) |
6389 self.setCursorPosition(seline, index) |
6390 self.ensureLineVisible(seline) |
6390 self.ensureLineVisible(seline) |
6391 |
6391 |
6687 warningAnnotations = [] |
6687 warningAnnotations = [] |
6688 errorAnnotations = [] |
6688 errorAnnotations = [] |
6689 styleAnnotations = [] |
6689 styleAnnotations = [] |
6690 |
6690 |
6691 # step 1: do warnings |
6691 # step 1: do warnings |
6692 for handle in self.warnings.keys(): |
6692 for handle in self.warnings: |
6693 if self.markerLine(handle) == line: |
6693 if self.markerLine(handle) == line: |
6694 for msg, warningType in self.warnings[handle]: |
6694 for msg, warningType in self.warnings[handle]: |
6695 if warningType == self.WarningStyle: |
6695 if warningType == self.WarningStyle: |
6696 styleAnnotations.append( |
6696 styleAnnotations.append( |
6697 self.tr("Style: {0}").format(msg)) |
6697 self.tr("Style: {0}").format(msg)) |
6698 else: |
6698 else: |
6699 warningAnnotations.append( |
6699 warningAnnotations.append( |
6700 self.tr("Warning: {0}").format(msg)) |
6700 self.tr("Warning: {0}").format(msg)) |
6701 |
6701 |
6702 # step 2: do syntax errors |
6702 # step 2: do syntax errors |
6703 for handle in self.syntaxerrors.keys(): |
6703 for handle in self.syntaxerrors: |
6704 if self.markerLine(handle) == line: |
6704 if self.markerLine(handle) == line: |
6705 for msg, _ in self.syntaxerrors[handle]: |
6705 for msg, _ in self.syntaxerrors[handle]: |
6706 errorAnnotations.append( |
6706 errorAnnotations.append( |
6707 self.tr("Error: {0}").format(msg)) |
6707 self.tr("Error: {0}").format(msg)) |
6708 |
6708 |