diff --git a/NEWS.md b/NEWS.md index 3b8e4102..6d581c2a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,7 +10,9 @@ Red Panda C++ Version 0.14.5 - fix: can't rename project files that not openned in editor - enhancement: group undo will stop at spaces - fix: menu font size is wrong when dpi changed - - enhancement: better processing of symbol completion + - enhancement: better processing of symbol completion + - enhancement: better support of ligatures + - enhancement: use the expression evaluation logic to handle "goto declaration"/"goto definition" Red Panda C++ Version 0.14.4 - enhancement: git - log diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 90ed9f54..96432248 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1120,7 +1120,6 @@ void Editor::mouseReleaseEvent(QMouseEvent *event) QString s = lines()->getString(p.Line - 1); if (mParser->isIncludeLine(s)) { QString filename = mParser->getHeaderFileName(mFilename,s); - qDebug()<editorList()->getEditorByFilename(filename); if (e) { e->setCaretPositionAndActivate(1,1); @@ -3658,17 +3657,25 @@ void Editor::setInProject(bool newInProject) void Editor::gotoDeclaration(const BufferCoord &pos) { - // Exit early, don't bother creating a stream (which is slow) - BufferCoord pBeginPos, pEndPos; - QString phrase = getWordAtPosition(this,pos,pBeginPos,pEndPos, WordPurpose::wpInformation); - if (phrase.isEmpty()) + if (!parser()) return; + // Exit early, don't bother creating a stream (which is slow) + QStringList expression = getExpressionAtPosition(pos); - PStatement statement = mParser->findStatementOf( - mFilename,phrase,pos.Line); + // Find it's definition + PStatement statement = parser()->findStatementOf( + filename(), + expression, + pos.Line); +// QString phrase = getWordAtPosition(this,pos,pBeginPos,pEndPos, WordPurpose::wpInformation); +// if (phrase.isEmpty()) +// return; + +// PStatement statement = mParser->findStatementOf( +// mFilename,phrase,pos.Line); if (!statement) { - pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase)); +// pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase)); return; } QString filename; @@ -3688,17 +3695,16 @@ void Editor::gotoDeclaration(const BufferCoord &pos) void Editor::gotoDefinition(const BufferCoord &pos) { - // Exit early, don't bother creating a stream (which is slow) - BufferCoord pBeginPos, pEndPos; - QString phrase = getWordAtPosition(this,pos,pBeginPos,pEndPos, WordPurpose::wpInformation); - if (phrase.isEmpty()) - return; + QStringList expression = getExpressionAtPosition(pos); - PStatement statement = mParser->findStatementOf( - mFilename,phrase,pos.Line); + // Find it's definition + PStatement statement = parser()->findStatementOf( + filename(), + expression, + pos.Line); if (!statement) { - pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase)); + // pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase)); return; } QString filename; diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index 9500500d..70f4e42a 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -400,7 +400,6 @@ void SynEditTextPainter::PaintToken(const QString &Token, int TokenCols, int Col } else { int tokenColLen=0; startPaint = false; - bool isAscii = true; for (int i=0;idrawText(nX,rcToken.bottom()-painter->fontMetrics().descent()*edit->dpiFactor() , Token[i]); if (startPaint) { - if (Token[i].unicode()<255) - isAscii=true; bool drawed = false; if (painter->fontInfo().fixedPitch() && edit->mOptions.testFlag(eoLigatureSupport) - && isAscii) { + && !Token[i].isSpace() + && (Token[i].unicode()<=0xFF)) { while(i+1=255) + if (Token[i+1].unicode()>0xFF || Token[i+1].isSpace()) break; i+=1; charCols += edit->charColumns(Token[i]); textToPaint+=Token[i]; } painter->drawText(nX,rcToken.bottom()-painter->fontMetrics().descent() , textToPaint); + qDebug()<drawText(nX,rcToken.bottom()-painter->fontMetrics().descent() , Token[i]); else { painter->setFont(fontForNonAscii);