Merged pull with local changes. 5_0_x

Sat, 28 Aug 2010 18:34:15 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 28 Aug 2010 18:34:15 +0200
branch
5_0_x
changeset 515
97f439894f09
parent 514
a3e454b3293d (current diff)
parent 511
94a3d27e3b0d (diff)
child 516
1a57b04e3bd2

Merged pull with local changes.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Sat Aug 28 18:32:51 2010 +0200
+++ b/APIs/Python3/eric5.api	Sat Aug 28 18:34:15 2010 +0200
@@ -4891,6 +4891,7 @@
 eric5.QScintilla.Printer.Printer?1(mode = QPrinter.ScreenResolution)
 eric5.QScintilla.QsciScintillaCompat.QSCINTILLA_VERSION?4()
 eric5.QScintilla.QsciScintillaCompat.QsciScintillaCompat.UserSeparator?7
+eric5.QScintilla.QsciScintillaCompat.QsciScintillaCompat._encodeString?5(string)
 eric5.QScintilla.QsciScintillaCompat.QsciScintillaCompat.byteAt?4(pos)
 eric5.QScintilla.QsciScintillaCompat.QsciScintillaCompat.charAt?4(pos)
 eric5.QScintilla.QsciScintillaCompat.QsciScintillaCompat.clearAllIndicators?4(indicator)
--- a/Documentation/Help/source.qhp	Sat Aug 28 18:32:51 2010 +0200
+++ b/Documentation/Help/source.qhp	Sat Aug 28 18:34:15 2010 +0200
@@ -4114,6 +4114,7 @@
       <keyword name="UnittestWindow (Constructor)" id="UnittestWindow (Constructor)" ref="eric5.PyUnit.UnittestDialog.html#UnittestWindow.__init__" />
       <keyword name="UnittestWindow.eventFilter" id="UnittestWindow.eventFilter" ref="eric5.PyUnit.UnittestDialog.html#UnittestWindow.eventFilter" />
       <keyword name="QScintilla (Package)" id="QScintilla (Package)" ref="index-eric5.QScintilla.html" />
+      <keyword name="QsciScintillaCompat._encodeString" id="QsciScintillaCompat._encodeString" ref="eric5.QScintilla.QsciScintillaCompat.html#QsciScintillaCompat._encodeString" />
       <keyword name="APIsManager (Module)" id="APIsManager (Module)" ref="eric5.QScintilla.APIsManager.html" />
       <keyword name="APIs" id="APIs" ref="eric5.QScintilla.APIsManager.html#APIs" />
       <keyword name="APIsManager" id="APIsManager" ref="eric5.QScintilla.APIsManager.html#APIsManager" />
--- a/Documentation/Source/eric5.QScintilla.QsciScintillaCompat.html	Sat Aug 28 18:32:51 2010 +0200
+++ b/Documentation/Source/eric5.QScintilla.QsciScintillaCompat.html	Sat Aug 28 18:34:15 2010 +0200
@@ -67,6 +67,9 @@
 <td><a href="#QsciScintillaCompat.__doSearchTarget">__doSearchTarget</a></td>
 <td>Private method to perform the search in target.</td>
 </tr><tr>
+<td><a href="#QsciScintillaCompat._encodeString">_encodeString</a></td>
+<td>Protected method to encode a string depending on the current mode.</td>
+</tr><tr>
 <td><a href="#QsciScintillaCompat.byteAt">byteAt</a></td>
 <td>Public method to get the raw character (bytes) at a position in the text.</td>
 </tr><tr>
@@ -313,6 +316,21 @@
 <dd>
 flag indicating a successful search (boolean)
 </dd>
+</dl><a NAME="QsciScintillaCompat._encodeString" ID="QsciScintillaCompat._encodeString"></a>
+<h4>QsciScintillaCompat._encodeString</h4>
+<b>_encodeString</b>(<i>string</i>)
+<p>
+        Protected method to encode a string depending on the current mode.
+</p><dl>
+<dt><i>string</i></dt>
+<dd>
+string to be encoded (str)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+encoded string (bytes)
+</dd>
 </dl><a NAME="QsciScintillaCompat.byteAt" ID="QsciScintillaCompat.byteAt"></a>
 <h4>QsciScintillaCompat.byteAt</h4>
 <b>byteAt</b>(<i>pos</i>)
@@ -485,7 +503,7 @@
 </p><dl>
 <dt><i>cmd</i></dt>
 <dd>
-the scintilla command to be performed
+the scintilla command to be performed (integer)
 </dd>
 </dl><a NAME="QsciScintillaCompat.extendSelectionLeft" ID="QsciScintillaCompat.extendSelectionLeft"></a>
 <h4>QsciScintillaCompat.extendSelectionLeft</h4>
@@ -1069,7 +1087,12 @@
 <b>setStyleBits</b>(<i>bits</i>)
 <p>
         Public method to set the number of bits to be used for styling.
-</p><a NAME="QsciScintillaCompat.setStyling" ID="QsciScintillaCompat.setStyling"></a>
+</p><dl>
+<dt><i>bits</i></dt>
+<dd>
+number of style bits (integer)
+</dd>
+</dl><a NAME="QsciScintillaCompat.setStyling" ID="QsciScintillaCompat.setStyling"></a>
 <h4>QsciScintillaCompat.setStyling</h4>
 <b>setStyling</b>(<i>length, style</i>)
 <p>
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Sat Aug 28 18:32:51 2010 +0200
+++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Sat Aug 28 18:34:15 2010 +0200
@@ -86,7 +86,7 @@
             itm.setIcon(0, UI.PixmapCache.getIcon("syntaxError.png"))
 ##        itm.setToolTip(0, file)
         itm.setData(0, self.filenameRole, file)
-        itm.setData(0, self.lineRole, line)
+        itm.setData(0, self.lineRole, int(line))
         itm.setData(0, self.errorRole, error)
         itm.setData(0, self.warningRole, isWarning)
         
--- a/QScintilla/Editor.py	Sat Aug 28 18:32:51 2010 +0200
+++ b/QScintilla/Editor.py	Sat Aug 28 18:34:15 2010 +0200
@@ -3633,24 +3633,24 @@
         cv = self.callTipsVisible()
         if cv > 0:
             # this is just a safe guard
-            ct = "\n".join(callTips[:cv])
+            ct = self._encodeString("\n".join(callTips[:cv]))
         else:
             # until here and unindent below
-            ct = "\n".join(callTips)
+            ct = self._encodeString("\n".join(callTips))
         
         self.SendScintilla(QsciScintilla.SCI_CALLTIPSHOW, 
                            self.__adjustedCallTipPosition(ctshift, pos), ct)
-        if '\n' in ct:
+        if b'\n' in ct:
             return
         
         # Highlight the current argument
         if commas == 0:
-            astart = ct.find('(')
+            astart = ct.find(b'(')
         else:
-            astart = ct.find(',')
+            astart = ct.find(b',')
             commas -= 1
             while astart != -1 and commas > 0:
-                astart = ct.find(',', astart + 1)
+                astart = ct.find(b',', astart + 1)
                 commas -= 1
         
         if astart == -1:
@@ -3658,20 +3658,20 @@
         
         depth = 0
         for aend in range(astart + 1, len(ct)):
-            ch = ct[aend]
+            ch = ct[aend:aend + 1]
             
-            if ch == ',' and depth == 0:
+            if ch == b',' and depth == 0:
                 break
-            elif ch == '(':
+            elif ch == b'(':
                 depth += 1
-            elif ch == ')':
+            elif ch == b')':
                 if depth == 0:
                     break
                 
                 depth -= 1
         
         if astart != aend:
-            self.SendScintilla(QsciScintilla.SCI_CALLTIPSETHLT, astart, aend)
+            self.SendScintilla(QsciScintilla.SCI_CALLTIPSETHLT, astart + 1, aend)
     
     def __adjustedCallTipPosition(self, ctshift, pos):
         """
@@ -4738,11 +4738,10 @@
             SIGNAL("rowsInserted(const QModelIndex &, int, int)"),
             self.__addBreakPoints)
         
-        self.disconnect(self.project, SIGNAL("projectPropertiesChanged"), 
-                        self.__projectPropertiesChanged)
-        
         if self.spell:
             self.spell.stopIncrementalCheck()
+            self.disconnect(self.project, SIGNAL("projectPropertiesChanged"), 
+                            self.__projectPropertiesChanged)
         
         QsciScintillaCompat.close(self)
         
--- a/QScintilla/QsciScintillaCompat.py	Sat Aug 28 18:32:51 2010 +0200
+++ b/QScintilla/QsciScintillaCompat.py	Sat Aug 28 18:34:15 2010 +0200
@@ -184,6 +184,8 @@
     def setStyleBits(self, bits):
         """
         Public method to set the number of bits to be used for styling.
+        
+        @param bits number of style bits (integer)
         """
         self.SendScintilla(QsciScintilla.SCI_SETSTYLEBITS, bits)
     
@@ -327,7 +329,7 @@
         """
         Public method to perform a simple editor command.
         
-        @param cmd the scintilla command to be performed
+        @param cmd the scintilla command to be performed (integer)
         """
         self.SendScintilla(cmd)
     
@@ -635,9 +637,10 @@
         self.SendScintilla(QsciScintilla.SCI_SETTARGETSTART, self.__targetSearchStart)
         self.SendScintilla(QsciScintilla.SCI_SETTARGETEND, self.__targetSearchEnd)
         self.SendScintilla(QsciScintilla.SCI_SETSEARCHFLAGS, self.__targetSearchFlags)
-        pos = self.SendScintilla(QsciScintilla.SCI_SEARCHINTARGET, 
-                                 len(self.__targetSearchExpr), 
-                                 self.__targetSearchExpr)
+        targetSearchExpr = self._encodeString(self.__targetSearchExpr)
+        pos = self.SendScintilla(QsciScintilla.SCI_SEARCHINTARGET,
+                                 len(targetSearchExpr), 
+                                 targetSearchExpr)
         
         if pos == -1:
             self.__targetSearchActive = False
@@ -737,14 +740,12 @@
             cmd = QsciScintilla.SCI_REPLACETARGETRE
         else:
             cmd = QsciScintilla.SCI_REPLACETARGET
+        r = self._encodeString(replaceStr)
         
         start = self.SendScintilla(QsciScintilla.SCI_GETTARGETSTART)
-        
-        r = replaceStr
-        
         self.SendScintilla(cmd, len(r), r)
         
-        self.__targetSearchStart = start + len(replaceStr)
+        self.__targetSearchStart = start + len(r)
     
     #####################################################################################
     # indicator handling methods
@@ -933,11 +934,27 @@
         
         self.SendScintilla(QsciScintilla.SCI_AUTOCSETSEPARATOR, 
                            ord(self.UserSeparator))
-        if self.isUtf8():
-            lst = self.UserSeparator.join(lst).encode("utf-8")
+        self.SendScintilla(QsciScintilla.SCI_USERLISTSHOW, id, 
+            self._encodeString(self.UserSeparator.join(lst)))
+    
+    #####################################################################################
+    # utility methods
+    #####################################################################################
+    
+    def _encodeString(self, string):
+        """
+        Protected method to encode a string depending on the current mode.
+        
+        @param string string to be encoded (str)
+        @return encoded string (bytes)
+        """
+        if isinstance(string, bytes):
+            return string
         else:
-            lst = self.UserSeparator.join(lst).encode("latin-1")
-        self.SendScintilla(QsciScintilla.SCI_USERLISTSHOW, id, lst)
+            if self.isUtf8():
+                return string.encode("utf-8")
+            else:
+                return string.encode("latin-1")
     
 ##    #####################################################################################
 ##    # methods below have been added to QScintilla starting with version after 2.x
--- a/Templates/TemplateViewer.py	Sat Aug 28 18:32:51 2010 +0200
+++ b/Templates/TemplateViewer.py	Sat Aug 28 18:34:15 2010 +0200
@@ -674,13 +674,16 @@
             # It should be done in this way to allow undo
             editor.beginUndoAction()
             if editor.hasSelectedText():
-                line = editor.getSelection()[0]
+                line, index = editor.getSelection()[0:2]
                 editor.removeSelectedText()
             else:
-                line = editor.getCursorPosition()[0]
+                line, index = editor.getCursorPosition()
             
-            if len(indent) > 0:
-                count += len(indent)
+            if lines == 1:
+                count += index
+            else:
+                if len(indent) > 0:
+                    count += len(indent)
             
             if "i_n_s_e_r_t_i_o_n" in txt and "s_e_l_e_c_t" in txt:
                 txt = "'Insertion and selection can not be in template together'"
@@ -691,8 +694,11 @@
                     count =  aline.find("i_n_s_e_r_t_i_o_n")
                     if count >= 0:
                         txt = txt.replace("i_n_s_e_r_t_i_o_n",  "")
-                        if len(indent) > 0:
-                            count += len(indent)
+                        if lines == 1:
+                            count += index
+                        else:
+                            if len(indent) > 0:
+                                count += len(indent)
                         break
                     else:
                         lines += 1

eric ide

mercurial