- enhancement: better support of ligatures
- enhancement: use the expression evaluation logic to handle "goto declaration"/"goto definition"
This commit is contained in:
parent
df7aba015d
commit
96de964484
2
NEWS.md
2
NEWS.md
|
@ -11,6 +11,8 @@ Red Panda C++ Version 0.14.5
|
||||||
- enhancement: group undo will stop at spaces
|
- enhancement: group undo will stop at spaces
|
||||||
- fix: menu font size is wrong when dpi changed
|
- 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
|
Red Panda C++ Version 0.14.4
|
||||||
- enhancement: git - log
|
- enhancement: git - log
|
||||||
|
|
|
@ -1120,7 +1120,6 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
|
||||||
QString s = lines()->getString(p.Line - 1);
|
QString s = lines()->getString(p.Line - 1);
|
||||||
if (mParser->isIncludeLine(s)) {
|
if (mParser->isIncludeLine(s)) {
|
||||||
QString filename = mParser->getHeaderFileName(mFilename,s);
|
QString filename = mParser->getHeaderFileName(mFilename,s);
|
||||||
qDebug()<<filename;
|
|
||||||
Editor * e = pMainWindow->editorList()->getEditorByFilename(filename);
|
Editor * e = pMainWindow->editorList()->getEditorByFilename(filename);
|
||||||
if (e) {
|
if (e) {
|
||||||
e->setCaretPositionAndActivate(1,1);
|
e->setCaretPositionAndActivate(1,1);
|
||||||
|
@ -3658,17 +3657,25 @@ void Editor::setInProject(bool newInProject)
|
||||||
|
|
||||||
void Editor::gotoDeclaration(const BufferCoord &pos)
|
void Editor::gotoDeclaration(const BufferCoord &pos)
|
||||||
{
|
{
|
||||||
// Exit early, don't bother creating a stream (which is slow)
|
if (!parser())
|
||||||
BufferCoord pBeginPos, pEndPos;
|
|
||||||
QString phrase = getWordAtPosition(this,pos,pBeginPos,pEndPos, WordPurpose::wpInformation);
|
|
||||||
if (phrase.isEmpty())
|
|
||||||
return;
|
return;
|
||||||
|
// Exit early, don't bother creating a stream (which is slow)
|
||||||
|
QStringList expression = getExpressionAtPosition(pos);
|
||||||
|
|
||||||
PStatement statement = mParser->findStatementOf(
|
// Find it's definition
|
||||||
mFilename,phrase,pos.Line);
|
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) {
|
if (!statement) {
|
||||||
pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase));
|
// pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString filename;
|
QString filename;
|
||||||
|
@ -3688,17 +3695,16 @@ void Editor::gotoDeclaration(const BufferCoord &pos)
|
||||||
|
|
||||||
void Editor::gotoDefinition(const BufferCoord &pos)
|
void Editor::gotoDefinition(const BufferCoord &pos)
|
||||||
{
|
{
|
||||||
// Exit early, don't bother creating a stream (which is slow)
|
QStringList expression = getExpressionAtPosition(pos);
|
||||||
BufferCoord pBeginPos, pEndPos;
|
|
||||||
QString phrase = getWordAtPosition(this,pos,pBeginPos,pEndPos, WordPurpose::wpInformation);
|
|
||||||
if (phrase.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
PStatement statement = mParser->findStatementOf(
|
// Find it's definition
|
||||||
mFilename,phrase,pos.Line);
|
PStatement statement = parser()->findStatementOf(
|
||||||
|
filename(),
|
||||||
|
expression,
|
||||||
|
pos.Line);
|
||||||
|
|
||||||
if (!statement) {
|
if (!statement) {
|
||||||
pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase));
|
// pMainWindow->updateStatusbarMessage(tr("Symbol '%1' not found!").arg(phrase));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString filename;
|
QString filename;
|
||||||
|
|
|
@ -400,7 +400,6 @@ void SynEditTextPainter::PaintToken(const QString &Token, int TokenCols, int Col
|
||||||
} else {
|
} else {
|
||||||
int tokenColLen=0;
|
int tokenColLen=0;
|
||||||
startPaint = false;
|
startPaint = false;
|
||||||
bool isAscii = true;
|
|
||||||
for (int i=0;i<Token.length();i++) {
|
for (int i=0;i<Token.length();i++) {
|
||||||
int charCols=0;
|
int charCols=0;
|
||||||
QString textToPaint = Token[i];
|
QString textToPaint = Token[i];
|
||||||
|
@ -419,24 +418,24 @@ void SynEditTextPainter::PaintToken(const QString &Token, int TokenCols, int Col
|
||||||
break;
|
break;
|
||||||
//painter->drawText(nX,rcToken.bottom()-painter->fontMetrics().descent()*edit->dpiFactor() , Token[i]);
|
//painter->drawText(nX,rcToken.bottom()-painter->fontMetrics().descent()*edit->dpiFactor() , Token[i]);
|
||||||
if (startPaint) {
|
if (startPaint) {
|
||||||
if (Token[i].unicode()<255)
|
|
||||||
isAscii=true;
|
|
||||||
bool drawed = false;
|
bool drawed = false;
|
||||||
if (painter->fontInfo().fixedPitch()
|
if (painter->fontInfo().fixedPitch()
|
||||||
&& edit->mOptions.testFlag(eoLigatureSupport)
|
&& edit->mOptions.testFlag(eoLigatureSupport)
|
||||||
&& isAscii) {
|
&& !Token[i].isSpace()
|
||||||
|
&& (Token[i].unicode()<=0xFF)) {
|
||||||
while(i+1<Token.length()) {
|
while(i+1<Token.length()) {
|
||||||
if (Token[i+1].unicode()>=255)
|
if (Token[i+1].unicode()>0xFF || Token[i+1].isSpace())
|
||||||
break;
|
break;
|
||||||
i+=1;
|
i+=1;
|
||||||
charCols += edit->charColumns(Token[i]);
|
charCols += edit->charColumns(Token[i]);
|
||||||
textToPaint+=Token[i];
|
textToPaint+=Token[i];
|
||||||
}
|
}
|
||||||
painter->drawText(nX,rcToken.bottom()-painter->fontMetrics().descent() , textToPaint);
|
painter->drawText(nX,rcToken.bottom()-painter->fontMetrics().descent() , textToPaint);
|
||||||
|
qDebug()<<textToPaint;
|
||||||
drawed = true;
|
drawed = true;
|
||||||
}
|
}
|
||||||
if (!drawed) {
|
if (!drawed) {
|
||||||
if (Token[i].unicode()<=255)
|
if (Token[i].unicode()<=0xFF)
|
||||||
painter->drawText(nX,rcToken.bottom()-painter->fontMetrics().descent() , Token[i]);
|
painter->drawText(nX,rcToken.bottom()-painter->fontMetrics().descent() , Token[i]);
|
||||||
else {
|
else {
|
||||||
painter->setFont(fontForNonAscii);
|
painter->setFont(fontForNonAscii);
|
||||||
|
|
Loading…
Reference in New Issue