核心编辑器组件升级到2.11

This commit is contained in:
爬山虎 2023-11-16 17:52:25 +08:00
parent e39e6014ee
commit ea55d37104
5 changed files with 41 additions and 12 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -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);

View File

@ -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());