- fix: cursor column info on status bar is wrong
- fix: can't correctly highlight function names in the editor
This commit is contained in:
parent
d3f7c872dd
commit
67fba515a3
|
@ -538,7 +538,7 @@ bool Editor::onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgr
|
|||
return false;
|
||||
}
|
||||
|
||||
void Editor::onPreparePaintHighlightToken(int row, int column, const QString &token, PSynHighlighterAttribute attr, SynFontStyles &style, QColor &foreground, QColor &background)
|
||||
void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &token, PSynHighlighterAttribute attr, SynFontStyles &style, QColor &foreground, QColor &background)
|
||||
{
|
||||
if (token.isEmpty())
|
||||
return;
|
||||
|
@ -557,10 +557,12 @@ void Editor::onPreparePaintHighlightToken(int row, int column, const QString &to
|
|||
}
|
||||
|
||||
|
||||
qDebug()<<token<<"-"<<attr->name()<<" - "<<line<<" : "<<aChar;
|
||||
if (mParser && mCompletionPopup && (attr->name() == SYNS_AttrIdentifier)) {
|
||||
BufferCoord p=displayToBufferPos(DisplayCoord{column+1,row});
|
||||
BufferCoord p{aChar,line};
|
||||
BufferCoord pBeginPos,pEndPos;
|
||||
QString s= getWordAtPosition(p, pBeginPos,pEndPos, WordPurpose::wpInformation);
|
||||
qDebug()<<s;
|
||||
PStatement statement = mParser->findStatementOf(mFilename,
|
||||
s , p.Line);
|
||||
StatementKind kind = mParser->getKindOfStatement(statement);
|
||||
|
@ -632,8 +634,6 @@ bool Editor::event(QEvent *event)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
qDebug()<<s<<" - "<<(int)reason;
|
||||
// Don't rescan the same stuff over and over again (that's slow)
|
||||
// if (s = fCurrentWord) and (fText.Hint<>'') then
|
||||
s = s.trimmed();
|
||||
|
@ -671,7 +671,7 @@ bool Editor::event(QEvent *event)
|
|||
if (!mCompletionPopup->isVisible()
|
||||
&& !mHeaderCompletionPopup->isVisible()) {
|
||||
if (pMainWindow->debugger()->executing()) {
|
||||
showDebugHint(s,line);
|
||||
showDebugHint(s,p.Line);
|
||||
} else { //if devEditor.ParserHints {
|
||||
hint = getParserHint(s, p.Line);
|
||||
}
|
||||
|
@ -1961,12 +1961,12 @@ QString Editor::getParserHint(const QString &s, int line)
|
|||
|
||||
void Editor::showDebugHint(const QString &s, int line)
|
||||
{
|
||||
PStatement statement = mParser->findStatementOf(s,mFilename,line);
|
||||
PStatement statement = mParser->findStatementOf(mFilename,s,line);
|
||||
if (statement) {
|
||||
if (statement->kind != StatementKind::skVariable
|
||||
|| statement->kind != StatementKind::skGlobalVariable
|
||||
|| statement->kind != StatementKind::skLocalVariable
|
||||
|| statement->kind != StatementKind::skParameter) {
|
||||
&& statement->kind != StatementKind::skGlobalVariable
|
||||
&& statement->kind != StatementKind::skLocalVariable
|
||||
&& statement->kind != StatementKind::skParameter) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ protected:
|
|||
|
||||
// SynEdit interface
|
||||
protected:
|
||||
void onPreparePaintHighlightToken(int row, int column, const QString &token, PSynHighlighterAttribute attr, SynFontStyles &style, QColor &foreground, QColor &background) override;
|
||||
void onPreparePaintHighlightToken(int line, int aChar, const QString &token, PSynHighlighterAttribute attr, SynFontStyles &style, QColor &foreground, QColor &background) override;
|
||||
|
||||
// QObject interface
|
||||
public:
|
||||
|
|
|
@ -435,11 +435,12 @@ void MainWindow::updateStatusbarForLineCol()
|
|||
{
|
||||
Editor* e = mEditorList->getEditor();
|
||||
if (e!=nullptr) {
|
||||
QString msg = tr("Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5")
|
||||
.arg(e->caretY(),6)
|
||||
.arg(e->caretX(),6)
|
||||
int col = e->charToColumn(e->caretY(),e->caretX());
|
||||
QString msg = tr("Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5")
|
||||
.arg(e->caretY(),4)
|
||||
.arg(col,3)
|
||||
.arg(e->selText().length(),6)
|
||||
.arg(e->lines()->count(),6)
|
||||
.arg(e->lines()->count(),4)
|
||||
.arg(e->lines()->getTextLength(),6);
|
||||
mFileInfoStatus->setText(msg);
|
||||
} else {
|
||||
|
|
|
@ -376,8 +376,8 @@ protected:
|
|||
virtual void onGutterGetText(int aLine, QString& aText);
|
||||
virtual void onGutterPaint(QPainter& painter, int aLine, int X, int Y);
|
||||
virtual void onPaint(QPainter& painter);
|
||||
virtual void onPreparePaintHighlightToken(int row,
|
||||
int column, const QString& token, PSynHighlighterAttribute attr,
|
||||
virtual void onPreparePaintHighlightToken(int line,
|
||||
int aChar, const QString& token, PSynHighlighterAttribute attr,
|
||||
SynFontStyles& style, QColor& foreground, QColor& background);
|
||||
virtual void onProcessCommand(SynEditorCommand Command, QChar AChar, void * pData);
|
||||
virtual void onCommandProcessed(SynEditorCommand Command, QChar AChar, void * pData);
|
||||
|
|
|
@ -579,7 +579,7 @@ void SynEditTextPainter::AddHighlightToken(const QString &Token, int ColumnsBefo
|
|||
}
|
||||
|
||||
//todo : change char(getTokenPos) to column?
|
||||
edit->onPreparePaintHighlightToken(cLine,edit->mHighlighter->getTokenPos(),
|
||||
edit->onPreparePaintHighlightToken(cLine,edit->mHighlighter->getTokenPos()+1,
|
||||
Token,p_Attri,Style,Foreground,Background);
|
||||
|
||||
// Do we have to paint the old chars first, or can we just append?
|
||||
|
|
Loading…
Reference in New Issue