- fix: Goto definition/Goto declaration/Info tips can't be correctly triggered when mouse pointer is at the last half character of current word.
This commit is contained in:
parent
dfed4accf6
commit
5e78c0aa62
1
NEWS.md
1
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
|
||||
|
||||
|
|
|
@ -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()<<gutterWidth()<<charWidth()<<point.y()<<point.x()<<pos.line<<pos.ch;
|
||||
if (!pMainWindow->debugger()->executing()
|
||||
&& getSyntaxIssueAtPosition(pos)) {
|
||||
return TipType::Error;
|
||||
|
|
|
@ -650,21 +650,15 @@ bool QSynEdit::pointToCharLine(const QPoint &point, BufferCoord &coord)
|
|||
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()));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue