Ver Fonte

核心编辑器组件升级到2.11

爬山虎 há 1 ano atrás
pai
commit
ea55d37104

+ 3 - 3
src/qscint/scintilla/src/LineMarker.cpp

@@ -358,7 +358,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
 			DrawMinus(surface, centreX, centreY, blobSize, colourTail);
 
 			surface->PenColour(colourHead);
-			surface->MoveTo(centreX, centreY + blobSize);
+			surface->MoveTo(centreX, centreY + blobSize + 1);
 			surface->LineTo(centreX, ircWhole.bottom);
 
 		}
@@ -369,7 +369,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
 			DrawMinus(surface, centreX, centreY, blobSize, colourTail);
 
 			surface->PenColour(colourHead);
-			surface->MoveTo(centreX, centreY + blobSize);
+			surface->MoveTo(centreX, centreY + blobSize + 1);
 			surface->LineTo(centreX, ircWhole.bottom);
 
 			surface->PenColour(colourBody);
@@ -440,7 +440,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
 
 		}
 		break;
-		
+
 		case SC_MARK_DOTDOTDOT: 
 		{
 			XYPOSITION right = static_cast<XYPOSITION>(centreX - 6);

+ 6 - 4
src/qscint/src/InputMethod.cpp

@@ -252,11 +252,13 @@ QVariant QsciScintillaBase::inputMethodQuery(Qt::InputMethodQuery query) const
         {
             int paraStart = sci->pdoc->ParaUp(pos);
             int paraEnd = sci->pdoc->ParaDown(pos);
-            QVarLengthArray<char,1024> buffer(paraEnd - paraStart + 1);
 
-           // Sci_CharacterRange charRange;
-           // charRange.cpMin = paraStart;
-           // charRange.cpMax = paraEnd;
+            if (paraEnd - paraStart <= 0)
+            {
+                return "";
+            }
+            QByteArray buffer(paraEnd - paraStart + 1,0);
+            //QVarLengthArray<char,1024> buffer(paraEnd - paraStart + 1);
 
             Sci_TextRange textRange;
             textRange.chrg.cpMin = paraStart;

+ 6 - 2
src/qscint/src/Qsci/qsciscintilla.h

@@ -1677,7 +1677,7 @@ public:
 	bool getHtmlHighLightTag();
 
     intptr_t searchInTarget(QByteArray& text2Find, size_t fromPos, size_t toPos) const;
-   
+
 
 public slots:
     //! Appends the text \a text to the end of the text edit.  Note that the
@@ -2234,6 +2234,10 @@ protected:
 
     }
 
+    //识别中文UTF8字符的情况。
+    virtual bool startAutoWordCompletion(AutoCompletionSource acs, bool checkThresh,
+        bool choose_single);
+
 private slots:
     void handleCallTipClick(int dir);
     void handleCharAdded(int charadded);
@@ -2292,7 +2296,7 @@ private:
             int visLevels = 0, int level = -1);
     void setFoldMarker(int marknr, int mark = SC_MARK_EMPTY);
     void setLexerStyle(int style);
- 
+
     void setEnabledColors(int style, QColor &fore, QColor &back);
 
     void braceMatch();

+ 1 - 1
src/qscint/src/qscilexerjson.cpp

@@ -60,7 +60,7 @@ QColor QsciLexerJSON::defaultColor(int style) const
     {
     case UnclosedString:
     case Error:
-        return QColor(0xff, 0xff, 0xff);
+        return QColor(0x0, 0x0, 0x0);
 
     case Number:
         return QColor(0x00, 0x7f, 0x7f);

+ 25 - 2
src/qscint/src/qsciscintilla.cpp

@@ -261,6 +261,14 @@ void QsciScintilla::handleCharAdded(int ch)
 
         return;
     }
+    else if (isListActive() && ch > 0x80)
+    {
+        cancelList();
+        //不是ascii字符,是中文UTF8的情况。
+         //识别中文Utf8字符。
+        startAutoWordCompletion(acSource, false, use_single == AcusAlways);
+        return;
+    }
 
     // Handle call tips.
     if (call_tips_style != CallTipsNone && !lex.isNull() && strchr("(),", ch) != NULL)
@@ -282,8 +290,14 @@ void QsciScintilla::handleCharAdded(int ch)
             startAutoCompletion(acSource, false, use_single == AcusAlways);
         else if (acThresh >= 1 && isWordCharacter(ch))
             startAutoCompletion(acSource, true, use_single == AcusAlways);
+        else if(ch > 0x80)
+        {
+            //不是ascii字符,是中文UTF8的情况。
+            //识别中文Utf8字符。
+            startAutoWordCompletion(acSource, false, use_single == AcusAlways);
     }
 }
+}
 
 
 // See if a call tip is active.
@@ -786,6 +800,15 @@ void QsciScintilla::startAutoCompletion(AutoCompletionSource acs,
 }
 
 
+
+//放在子类中去完成。
+bool QsciScintilla::startAutoWordCompletion(AutoCompletionSource acs,
+    bool checkThresh, bool choose_single)
+{
+    return false;
+}
+
+
 // Maintain the indentation of the previous line.
 void QsciScintilla::maintainIndentation(char ch, long pos)
 {
@@ -1915,7 +1938,7 @@ bool QsciScintilla::doFind()
 int QsciScintilla::simpleFind()
 {
 	/*这里是会大于的,因为我在外面会零长查找时,会增加startPos的值。如果是向前,才这样处理*/
-	
+
 	if (findState.forward && (findState.startpos >= findState.endpos)) {
         return -1;
 	}
@@ -3687,7 +3710,7 @@ void QsciScintilla::setStylesFont(const QFont &f, int style)
 
     // Pass the Qt weight via the back door.
     //SendScintilla(SCI_STYLESETWEIGHT, style, -f.weight());
-    
+
     //20230712 发现粗体总是存在混淆,修改一个风格,会导致其余风格也被设置。于是注释掉上面的SCI_STYLESETWEIGHT
     //使用下面的SCI_STYLESETBOLD取代后,发现问题解除。
     SendScintilla(SCI_STYLESETBOLD, style, f.bold());