QScintilla/Editor.py

branch
5_0_x
changeset 504
da6d0d7037e5
parent 450
4c6920a05411
child 508
88a4ce2bcd18
equal deleted inserted replaced
503:3f841c622b96 504:da6d0d7037e5
3631 ctshift = shift 3631 ctshift = shift
3632 3632
3633 cv = self.callTipsVisible() 3633 cv = self.callTipsVisible()
3634 if cv > 0: 3634 if cv > 0:
3635 # this is just a safe guard 3635 # this is just a safe guard
3636 ct = "\n".join(callTips[:cv]) 3636 ct = self._encodeString("\n".join(callTips[:cv]))
3637 else: 3637 else:
3638 # until here and unindent below 3638 # until here and unindent below
3639 ct = "\n".join(callTips) 3639 ct = self._encodeString("\n".join(callTips))
3640 3640
3641 self.SendScintilla(QsciScintilla.SCI_CALLTIPSHOW, 3641 self.SendScintilla(QsciScintilla.SCI_CALLTIPSHOW,
3642 self.__adjustedCallTipPosition(ctshift, pos), ct) 3642 self.__adjustedCallTipPosition(ctshift, pos), ct)
3643 if '\n' in ct: 3643 if b'\n' in ct:
3644 return 3644 return
3645 3645
3646 # Highlight the current argument 3646 # Highlight the current argument
3647 if commas == 0: 3647 if commas == 0:
3648 astart = ct.find('(') 3648 astart = ct.find(b'(')
3649 else: 3649 else:
3650 astart = ct.find(',') 3650 astart = ct.find(b',')
3651 commas -= 1 3651 commas -= 1
3652 while astart != -1 and commas > 0: 3652 while astart != -1 and commas > 0:
3653 astart = ct.find(',', astart + 1) 3653 astart = ct.find(b',', astart + 1)
3654 commas -= 1 3654 commas -= 1
3655 3655
3656 if astart == -1: 3656 if astart == -1:
3657 return 3657 return
3658 3658
3659 depth = 0 3659 depth = 0
3660 for aend in range(astart + 1, len(ct)): 3660 for aend in range(astart + 1, len(ct)):
3661 ch = ct[aend] 3661 ch = ct[aend:aend + 1]
3662 3662
3663 if ch == ',' and depth == 0: 3663 if ch == b',' and depth == 0:
3664 break 3664 break
3665 elif ch == '(': 3665 elif ch == b'(':
3666 depth += 1 3666 depth += 1
3667 elif ch == ')': 3667 elif ch == b')':
3668 if depth == 0: 3668 if depth == 0:
3669 break 3669 break
3670 3670
3671 depth -= 1 3671 depth -= 1
3672 3672
3673 if astart != aend: 3673 if astart != aend:
3674 self.SendScintilla(QsciScintilla.SCI_CALLTIPSETHLT, astart, aend) 3674 self.SendScintilla(QsciScintilla.SCI_CALLTIPSETHLT, astart + 1, aend)
3675 3675
3676 def __adjustedCallTipPosition(self, ctshift, pos): 3676 def __adjustedCallTipPosition(self, ctshift, pos):
3677 """ 3677 """
3678 Private method to calculate an adjusted position for showing calltips. 3678 Private method to calculate an adjusted position for showing calltips.
3679 3679

eric ide

mercurial