diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 9b6e2acf..ff29a0f7 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1149,8 +1149,8 @@ void Editor::onGetEditingAreas(int Line, QSynedit::EditingAreaList &areaList) if (lst) { for (const PSyntaxIssue& issue: *lst) { QSynedit::PEditingArea p=std::make_shared(); - p->beginX = issue->col; - p->endX = issue->endCol; + p->beginX = issue->startChar; + p->endX = issue->endChar; if (issue->issueType == CompileIssueType::Error) { p->color = mSyntaxErrorColor; } else { @@ -1640,8 +1640,6 @@ void Editor::addSyntaxIssues(int line, int startChar, int endChar, CompileIssueT } pError->startChar = start; pError->endChar = start + token.length(); - pError->col = pError->startChar; - pError->endCol = pError->endChar; pError->hint = hint; pError->token = token; pError->issueType = errorType; diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index 7a8e3d19..ad5d3f02 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -110,8 +110,6 @@ public: }; struct SyntaxIssue { - int col; - int endCol; int startChar; int endChar; CompileIssueType issueType; diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 5abc8de7..4c129f7e 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1481,7 +1481,7 @@ void Settings::Editor::doLoad() //Editor font mFontName = stringValue("font_name",DEFAULT_MONO_FONT); - QString defaultCjkFontName = CJK_MONO_FONT_SC; + QString defaultCjkFontName = DEFAULT_MONO_FONT; QString defaultLocaleName = QLocale::system().name(); if (defaultLocaleName == "zh_TW") defaultCjkFontName = CJK_MONO_FONT_TC; @@ -1489,10 +1489,12 @@ void Settings::Editor::doLoad() defaultCjkFontName = CJK_MONO_FONT_J; else if (defaultLocaleName == "ko_KR") defaultCjkFontName = CJK_MONO_FONT_K; + else if (defaultLocaleName == "zh_CN") + defaultCjkFontName = CJK_MONO_FONT_SC; mNonAsciiFontName = stringValue("non_ascii_font_name",defaultCjkFontName); mFontSize = intValue("font_size",12); mFontOnlyMonospaced = boolValue("font_only_monospaced",true); - mLineSpacing = doubleValue("line_spacing",1.0); + mLineSpacing = doubleValue("line_spacing",1.1); mEnableLigaturesSupport = boolValue("enable_ligatures_support", true); mShowLeadingSpaces = boolValue("show_leading_spaces", false); diff --git a/libs/qsynedit/qsynedit/document.cpp b/libs/qsynedit/qsynedit/document.cpp index 7e7b3cef..09ebe9c9 100644 --- a/libs/qsynedit/qsynedit/document.cpp +++ b/libs/qsynedit/qsynedit/document.cpp @@ -1218,16 +1218,7 @@ DocumentLine::DocumentLine(DocumentLine::UpdateWidthFunc updateWidthFunc): int DocumentLine::glyphLength(int i) const { - if (i<0 || i>=mGlyphStartCharList.length()) - return 0; - int start = glyphStartChar(i); - int end; - if (i+1=mGlyphStartPositionList.length()) - return 0; - if( mWidth <0) + if (mWidth <0) updateWidth(); - int start = glyphStartPosition(i); - int end; - if (i+1 glyphStartCharList) +void expandGlyphStartCharList(const QString &strAdded, int oldStrLen, QList &glyphStartCharList) { QList addedList = calcGlyphStartCharList(strAdded); for (int i=0;i &segList, int minVal, int maxVal, int v int calcSegmentInterval(const QList &segList, int maxVal, int idx); int segmentIntervalStart(const QList &segList, int minVal, int maxVal, int idx); QList calcGlyphStartCharList(const QString &text); -void expandGlyphStartCharList(const QString& strAdded, int oldStrLen, QList glyphStartCharList); +void expandGlyphStartCharList(const QString& strAdded, int oldStrLen, QList &glyphStartCharList); class Document; diff --git a/libs/qsynedit/qsynedit/painter.cpp b/libs/qsynedit/qsynedit/painter.cpp index f6b7f05f..5198d2b2 100644 --- a/libs/qsynedit/qsynedit/painter.cpp +++ b/libs/qsynedit/qsynedit/painter.cpp @@ -190,7 +190,7 @@ void QSynEditPainter::paintGutter(const QRect& clip) // Form a rectangle for the square the user can click on rcFold.setLeft(mEdit->mGutterWidth - mEdit->mGutter.rightOffset()); - rcFold.setTop(( - mEdit->mTopLine) * mEdit->mTextHeight); + rcFold.setTop((row - mEdit->mTopLine) * mEdit->mTextHeight); rcFold.setRight(rcFold.left() + mEdit->mGutter.rightOffset() - 4); rcFold.setBottom(rcFold.top() + mEdit->mTextHeight); @@ -250,7 +250,7 @@ void QSynEditPainter::paintGutter(const QRect& clip) int line = mEdit->rowToLine(row); if ((line > mEdit->mDocument->count()) && (mEdit->mDocument->count() != 0)) break; - mEdit->onGutterPaint(*mPainter,line, 0, ( - mEdit->mTopLine) * mEdit->mTextHeight); + mEdit->onGutterPaint(*mPainter,line, 0, (row - mEdit->mTopLine) * mEdit->mTextHeight); } } @@ -1198,7 +1198,8 @@ void QSynEditPainter::paintLines() } if (!addOnStr.isEmpty()) { expandGlyphStartCharList(addOnStr, sLine.length(), glyphStartCharList); - for (int i=0;imSyntaxer->symbolAttribute(); @@ -1232,9 +1233,9 @@ void QSynEditPainter::paintLines() } } int glyphIdx; - glyphIdx = searchForSegmentIdx(glyphStartCharList, 0, sLine.length(), area->beginX); + glyphIdx = searchForSegmentIdx(glyphStartCharList, 0, sLine.length(), area->beginX-1); area->beginX = segmentIntervalStart(glyphStartPositionsList, 0, tokenLeft, glyphIdx); - glyphIdx = searchForSegmentIdx(glyphStartCharList, 0, sLine.length(), area->endX); + glyphIdx = searchForSegmentIdx(glyphStartCharList, 0, sLine.length(), area->endX-1); area->endX = segmentIntervalStart(glyphStartPositionsList, 0, tokenLeft, glyphIdx); } //input method