diff --git a/NEWS.md b/NEWS.md index 19bf5ddd..65017fd4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ Red Panda C++ Version 2.23 - enhancement: Code completion for '->' operator on std iterators. - enhancement: Tooltip support for '->' operator on std iterators. - enhancement: Close other editors. + - fix: Goto definition/Goto declaration/Info tips can't be correctly triggered when mouse pointer is at the last half character of current word. Red Panda C++ Version 2.22 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 9706be36..d0a284d2 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -3954,6 +3954,7 @@ Editor::TipType Editor::getTipType(QPoint point, QSynedit::BufferCoord& pos) { // Only allow in the text area... if (pointToCharLine(point, pos) && syntaxer()) { + //qDebug()<debugger()->executing() && getSyntaxIssueAtPosition(pos)) { return TipType::Error; diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index 108e977e..82d7c359 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -644,28 +644,22 @@ bool QSynEdit::pointToCharLine(const QPoint &point, BufferCoord &coord) { // Make sure it fits within the SynEdit bounds (and on the gutter) if ((point.x() < gutterWidth() + clientLeft()) - || (point.x()>clientWidth()+clientLeft()) + || (point.x()> clientWidth()+clientLeft()) || (point.y() < clientTop()) || (point.y() > clientTop()+clientHeight())) { return false; } - coord = displayToBufferPos(pixelsToNearestRowColumn(point.x(),point.y())); + coord = displayToBufferPos(pixelsToRowColumn(point.x(),point.y())); return true; } bool QSynEdit::pointToLine(const QPoint &point, int &line) { - // Make sure it fits within the SynEdit bounds - if ((point.x() < clientLeft()) - || (point.x()>clientWidth()+clientLeft()) - || (point.y() < clientTop()) - || (point.y() > clientTop()+clientHeight())) { - return false; - } - - BufferCoord coord = displayToBufferPos(pixelsToNearestRowColumn(point.x(),point.y())); - line = coord.line; + BufferCoord coord; + bool result = pointToCharLine(point,coord); + if (result) + line=coord.line; return true; } @@ -1225,23 +1219,23 @@ void QSynEdit::unCollpaseAll() void QSynEdit::processGutterClick(QMouseEvent *event) { - int X = event->pos().x(); - int Y = event->pos().y(); - DisplayCoord RowColumn = pixelsToNearestRowColumn(X, Y); - int Line = rowToLine(RowColumn.Row); + int x = event->pos().x(); + int y = event->pos().y(); + DisplayCoord rowColumn = pixelsToNearestRowColumn(x, y); + int line = rowToLine(rowColumn.Row); // Check if we clicked on a folding thing if (mUseCodeFolding) { - PCodeFoldingRange foldRange = foldStartAtLine(Line); + PCodeFoldingRange foldRange = foldStartAtLine(line); if (foldRange) { // See if we actually clicked on the rectangle... //rect.Left := Gutter.RealGutterWidth(CharWidth) - Gutter.RightOffset; QRect rect; rect.setLeft(mGutterWidth - mGutter.rightOffset()); rect.setRight(rect.left() + mGutter.rightOffset() - 4); - rect.setTop((RowColumn.Row - mTopLine) * mTextHeight); + rect.setTop((rowColumn.Row - mTopLine) * mTextHeight); rect.setBottom(rect.top() + mTextHeight - 1); - if (rect.contains(QPoint(X, Y))) { + if (rect.contains(event->pos())) { if (foldRange->collapsed) uncollapse(foldRange); else @@ -1252,8 +1246,8 @@ void QSynEdit::processGutterClick(QMouseEvent *event) } // If not, check gutter marks - if (Line>=1 && Line <= mDocument->count()) { - emit gutterClicked(event->button(),X,Y,Line); + if (line>=1 && line <= mDocument->count()) { + emit gutterClicked(event->button(),x,y,line); } }