diff --git a/NEWS.md b/NEWS.md index 0979de99..8d2187a8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ Red Panda C++ Version 1.0.1 - fix: only convert project icon file when it's filename doesn't end with ".ico" + - fix: hide function tip when scroll + - fix: short cut for goto definition/declaration doesn't work Red Panda C++ Version 1.0.0 - fix: calculation for code snippets's tab stop positions is not correct diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 497d7a78..70f27ef2 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include "iconsmanager.h" #include "debugger.h" #include "editorlist.h" @@ -177,6 +178,11 @@ Editor::Editor(QWidget *parent, const QString& filename, } connect(&mFunctionTipTimer, &QTimer::timeout, this, &Editor::onFunctionTipsTimer); + + connect(horizontalScrollBar(), &QScrollBar::valueChanged, + this, &Editor::onScrollBarValueChanged); + connect(verticalScrollBar(), &QScrollBar::valueChanged, + this, &Editor::onScrollBarValueChanged); } Editor::~Editor() { @@ -1561,7 +1567,7 @@ void Editor::onStatusChanged(SynStatusChanges changes) updateFunctionTip(false); mFunctionTipTimer.stop(); mFunctionTipTimer.start(500); -// updateFunctionTip(); +// updateFunctionTip(); } } @@ -3723,6 +3729,11 @@ void Editor::onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line, } } +void Editor::onScrollBarValueChanged() +{ + pMainWindow->functionTip()->hide(); +} + bool Editor::canAutoSave() const { return mCanAutoSave; @@ -3787,11 +3798,14 @@ void Editor::setInProject(bool newInProject) void Editor::gotoDeclaration(const BufferCoord &pos) { + qDebug()<<"???"; if (!parser()) return; // Exit early, don't bother creating a stream (which is slow) QStringList expression = getExpressionAtPosition(pos); + qDebug()<findStatementOf( filename(), diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index b0442eaf..b8cfa93c 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -283,6 +283,7 @@ private: void popUserCodeInTabStops(); void onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line, int column, const QString& token, PSynHighlighterAttribute &attr); + void onScrollBarValueChanged(); private: QByteArray mEncodingOption; // the encoding type set by the user QByteArray mFileEncoding; // the real encoding of the file (auto detected) diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 7912b01e..143bbb58 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -5266,19 +5266,16 @@ void MainWindow::on_actionBreakpoint_property_triggered() void MainWindow::on_actionGoto_Declaration_triggered() { Editor * editor = mEditorList->getEditor(); - BufferCoord pos; - if (editor && editor->pointToCharLine(mEditorContextMenuPos,pos)) { - editor->gotoDeclaration(pos); + if (editor) { + editor->gotoDeclaration(editor->caretXY()); } } - void MainWindow::on_actionGoto_Definition_triggered() { Editor * editor = mEditorList->getEditor(); - BufferCoord pos; - if (editor && editor->pointToCharLine(mEditorContextMenuPos,pos)) { - editor->gotoDefinition(pos); + if (editor) { + editor->gotoDefinition(editor->caretXY()); } } diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 26960008..80e361b4 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -5795,6 +5795,19 @@ void SynEdit::updateMouseCursor(){ } } +bool SynEdit::isCaretVisible() +{ + if (mCaretY < mTopLine) + return false; + if (mCaretY >= mTopLine + mLinesInWindow ) + return false; + if (mCaretX < mLeftChar) + return false; + if (mCaretX >= mLeftChar + mCharsInWindow) + return false; + return true; +} + void SynEdit::paintEvent(QPaintEvent *event) { if (mPainterLock>0) diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index 848b22f0..afe464e0 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -300,6 +300,8 @@ public: void updateMouseCursor(); + bool isCaretVisible(); + // setter && getters int topLine() const; void setTopLine(int value);