Skip to content

Commit 93e2330

Browse files
committed
Symbol Info popup - constrain width
1 parent 972ab41 commit 93e2330

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/SharpIDE.Godot/Features/CodeEditor/SharpIdeCodeEdit_SymbolHover.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ private async void OnSymbolHovered(string symbol, long line, long column)
143143
ContentMarginRight = 12
144144
};
145145

146-
PanelContainer? diagnosticPanel = null;
146+
PanelContainer? diagnosticPanel = null;
147147
if (diagnosticsForLinePosition is not null)
148148
{
149149
var diagnosticNode = SymbolInfoComponents.GetDiagnostic(diagnosticsForLinePosition);
150150
diagnosticNode.FitContent = true;
151-
diagnosticNode.AutowrapMode = TextServer.AutowrapMode.Off;
152-
diagnosticNode.SetAnchorsPreset(Control.LayoutPreset.FullRect);
151+
diagnosticNode.AutowrapMode = TextServer.AutowrapMode.WordSmart;
152+
diagnosticNode.SetAnchorsPreset(LayoutPreset.FullRect);
153153
diagnosticNode.SelectionEnabled = true;
154154
diagnosticPanel = new PanelContainer();
155155
diagnosticPanel.AddThemeStyleboxOverride(ThemeStringNames.Panel, styleBox);
@@ -179,8 +179,8 @@ private async void OnSymbolHovered(string symbol, long line, long column)
179179
if (symbolInfoNode is not null)
180180
{
181181
symbolInfoNode.FitContent = true;
182-
symbolInfoNode.AutowrapMode = TextServer.AutowrapMode.Off;
183-
symbolInfoNode.SetAnchorsPreset(Control.LayoutPreset.FullRect);
182+
symbolInfoNode.AutowrapMode = TextServer.AutowrapMode.WordSmart;
183+
symbolInfoNode.SetAnchorsPreset(LayoutPreset.FullRect);
184184
symbolInfoNode.SelectionEnabled = true;
185185
symbolInfoPanel = new PanelContainer();
186186
symbolInfoPanel.AddThemeStyleboxOverride(ThemeStringNames.Panel, styleBox);
@@ -192,6 +192,11 @@ private async void OnSymbolHovered(string symbol, long line, long column)
192192
vboxContainer.AddThemeConstantOverride(ThemeStringNames.Separation, 0);
193193
if (diagnosticPanel is not null) vboxContainer.AddChild(diagnosticPanel);
194194
if (symbolInfoPanel is not null) vboxContainer.AddChild(symbolInfoPanel);
195+
196+
var rightEdgePosition = GetViewport().GetVisibleRect().Size.X;
197+
var maxWidth = rightEdgePosition - globalMousePosition.X - 20;
198+
199+
vboxContainer.CustomMaximumSize = new Vector2(maxWidth, -1);
195200
tooltipWindow.AddChild(vboxContainer);
196201
tooltipWindow.ChildControlsChanged();
197202
AddChild(tooltipWindow);

0 commit comments

Comments
 (0)