MouseBindings in UICodeEditor WIP.

This commit is contained in:
Martín Lucas Golini
2025-08-25 00:41:54 -03:00
parent 48d43e6403
commit bdde898d52
22 changed files with 252 additions and 156 deletions

View File

@@ -197,9 +197,7 @@ static const char* DEFAULT_CHAT_GLOBE = R"xml(
)xml";
LLMChatUI::LLMChatUI( PluginManager* manager ) :
UILinearLayout(),
WidgetCommandExecuter( getUISceneNode()->getWindow()->getInput() ),
mManager( manager ) {
UILinearLayout(), WidgetCommandExecuter( getInput() ), mManager( manager ) {
setClass( "llm_chatui" );
setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::MatchParent );

View File

@@ -2465,22 +2465,21 @@ bool DebuggerPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& position
const std::optional<EvaluateInfo>& info ) {
if ( info && mManager->getSplitter()->editorExists( editor ) &&
!info->result.empty() ) {
editor->runOnMainThread( [this, editor, info = std::move( *info ),
expression]() {
auto mousePos =
editor->getUISceneNode()->getWindow()->getInput()->getMousePos();
if ( !editor->getScreenRect().contains( mousePos.asFloat() ) )
return;
editor->runOnMainThread(
[this, editor, info = std::move( *info ), expression]() {
auto mousePos = editor->getInput()->getMousePos();
if ( !editor->getScreenRect().contains( mousePos.asFloat() ) )
return;
auto docPos = editor->resolveScreenPosition( mousePos.asFloat() );
auto range =
editor->getDocument().getWordRangeInPosition( docPos, true );
auto docPos = editor->resolveScreenPosition( mousePos.asFloat() );
auto range =
editor->getDocument().getWordRangeInPosition( docPos, true );
if ( mCurrentHover.contains( range ) ) {
mCurrentHover = range;
displayTooltip( editor, expression, info, mousePos.asFloat() );
}
} );
if ( mCurrentHover.contains( range ) ) {
mCurrentHover = range;
displayTooltip( editor, expression, info, mousePos.asFloat() );
}
} );
}
} );
},

View File

@@ -644,7 +644,7 @@ bool LSPClientPlugin::onMouseClick( UICodeEditor* editor, const Vector2i& pos,
}
}
Input* input = editor->getUISceneNode()->getWindow()->getInput();
Input* input = editor->getInput();
Uint32 mod = input->getSanitizedModState();
if ( mod != ( KEYMOD_LALT | KeyMod::getDefaultModifier() ) || ( flags & EE_BUTTON_LMASK ) == 0 )
return false;
@@ -1642,8 +1642,7 @@ void LSPClientPlugin::hideTooltip( UICodeEditor* editor ) {
}
static TextPosition currentMouseTextPosition( UICodeEditor* editor ) {
return editor->resolveScreenPosition(
editor->getUISceneNode()->getWindow()->getInput()->getMousePos().asFloat() );
return editor->resolveScreenPosition( editor->getInput()->getMousePos().asFloat() );
}
void LSPClientPlugin::tryHideTooltip( UICodeEditor* editor, const Vector2i& position ) {