| 1392 | } |
| 1393 | |
| 1394 | bool LinterPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& pos, const Uint32& flags ) { |
| 1395 | if ( mQuickFixRect.Right != 0 && mQuickFixRect.Bottom != 0 && |
| 1396 | mQuickFixRect.contains( pos.asFloat() ) ) { |
| 1397 | editor->getUISceneNode()->setCursor( Cursor::Hand ); |
| 1398 | return true; |
| 1399 | } |
| 1400 | if ( flags != 0 ) { |
| 1401 | tryHideHoveringMatch( editor ); |
| 1402 | return false; |
| 1403 | } |
| 1404 | |
| 1405 | if ( editor->hasDocument() && editor->getDocument().isLoading() ) |
| 1406 | return false; |
| 1407 | |
| 1408 | Vector2f localPos( editor->convertToNodeSpace( pos.asFloat() ) ); |
| 1409 | TextPosition cursorPosition = editor->resolveScreenPosition( pos.asFloat() ); |
| 1410 | if ( localPos.x <= editor->getGutterWidth() ) |
| 1411 | return false; |
| 1412 | |
| 1413 | Lock l( mMatchesMutex ); |
| 1414 | auto it = mMatches.find( editor->getDocumentRef().get() ); |
| 1415 | if ( it != mMatches.end() ) { |
| 1416 | auto matchIt = it->second.find( cursorPosition.line() ); |
| 1417 | if ( matchIt != it->second.end() ) { |
| 1418 | auto& matches = matchIt->second; |
| 1419 | for ( auto& match : matches ) { |
| 1420 | if ( match.box[editor].contains( localPos ) || |
| 1421 | match.lensBox[editor].contains( localPos ) ) { |
| 1422 | if ( match.text.empty() ) |
| 1423 | return false; |
| 1424 | mHoveringMatch = true; |
| 1425 | editor->setTooltipText( match.text ); |
| 1426 | UITooltip* tooltip = editor->createTooltip(); |
| 1427 | if ( tooltip == nullptr ) |
| 1428 | return false; |
| 1429 | tooltip->setHorizontalAlign( UI_HALIGN_LEFT ); |
| 1430 | tooltip->setDontAutoHideOnMouseMove( true ); |
| 1431 | tooltip->setPixelsPosition( tooltip->getTooltipPosition( pos.asFloat() ) ); |
| 1432 | mOldWordWrap = tooltip->isWordWrap(); |
| 1433 | mOldMaxWidth = tooltip->getMaxWidthEq(); |
| 1434 | tooltip->setWordWrap( true ); |
| 1435 | tooltip->setMaxWidthEq( "50vw" ); |
| 1436 | if ( !tooltip->isVisible() ) |
| 1437 | tooltip->show(); |
| 1438 | return true; |
| 1439 | } |
| 1440 | } |
| 1441 | } |
| 1442 | tryHideHoveringMatch( editor ); |
| 1443 | } |
| 1444 | return false; |
| 1445 | } |
| 1446 | |
| 1447 | bool LinterPlugin::onMouseLeave( UICodeEditor* editor, const Vector2i&, const Uint32& ) { |
| 1448 | tryHideHoveringMatch( editor ); |
nothing calls this directly
no test coverage detected