@@ -222,52 +222,21 @@ namespace winrt::Microsoft::Terminal::Control::implementation
222
222
auto quickFixBtn{ QuickFixButton () };
223
223
quickFixBtn.PointerEntered ({ get_weak (), &TermControl::QuickFixButton_PointerEntered });
224
224
quickFixBtn.PointerExited ({ get_weak (), &TermControl::QuickFixButton_PointerExited });
225
- // quickFixBtn.PointerEntered([/*this*/ weakThis = get_weak()](auto&&, auto&&) {
226
- //
227
- // // TODO CARLOS: Tried this but *control isn't the right type
228
- // // Error: Microsoft.Terminal.Control.dll!00007FFAA70B2AFF: ReturnHr(1) tid(a514) 80070057 The parameter is incorrect.
229
- // // Debugger opens WindowThread.cpp; does that mean this is the wrong thread?
230
- // if (auto control = weakThis.get())
231
- // {
232
- // if (control->_quickFixButtonCollapsible)
233
- // {
234
- // VisualStateManager::GoToState(*control, StateNormal, true);
235
- // }
236
- // }
237
- // //if (_quickFixButtonCollapsible)
238
- // //{
239
- // // // TODO CARLOS: this crashes due to "invalid param" (probably the same for pointer exited)
240
- // // VisualStateManager::GoToState(*this, StateNormal, true);
241
- // //}
242
- // });
243
- // quickFixBtn.PointerExited([/*this*/ weakThis = get_weak()](auto&&, auto&&) {
244
- // if (auto control = weakThis.get())
245
- // {
246
- // if (control->_quickFixButtonCollapsible)
247
- // {
248
- // VisualStateManager::GoToState(*control, StateCollapsed, true);
249
- // }
250
- // }
251
- // //if (_quickFixButtonCollapsible)
252
- // //{
253
- // // VisualStateManager::GoToState(*this, StateCollapsed, true);
254
- // //}
255
- // });
256
225
}
257
226
258
227
void TermControl::QuickFixButton_PointerEntered (const IInspectable& /* sender*/ , const PointerRoutedEventArgs& /* e*/ )
259
228
{
260
229
if (!_IsClosing () && _quickFixButtonCollapsible)
261
230
{
262
- VisualStateManager::GoToState (*this , StateNormal, true );
231
+ VisualStateManager::GoToState (*this , StateNormal, false );
263
232
}
264
233
}
265
234
266
235
void TermControl::QuickFixButton_PointerExited (const IInspectable& /* sender*/ , const PointerRoutedEventArgs& /* e*/ )
267
236
{
268
237
if (!_IsClosing () && _quickFixButtonCollapsible)
269
238
{
270
- VisualStateManager::GoToState (*this , StateCollapsed, true );
239
+ VisualStateManager::GoToState (*this , StateCollapsed, false );
271
240
}
272
241
}
273
242
@@ -2228,6 +2197,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
2228
2197
{
2229
2198
_updateSelectionMarkers (nullptr , winrt::make<UpdateSelectionMarkersEventArgs>(false ));
2230
2199
}
2200
+
2201
+ if (QuickFixButton ().Visibility () == Visibility::Visible)
2202
+ {
2203
+ ShowQuickFixMenu ();
2204
+ }
2231
2205
}
2232
2206
2233
2207
// Method Description:
@@ -3480,15 +3454,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
3480
3454
scaleMarker (SelectionStartMarker ());
3481
3455
scaleMarker (SelectionEndMarker ());
3482
3456
3483
- OutputDebugString (L" Font Size:" );
3484
- OutputDebugString (std::to_wstring (QuickFixIcon ().FontSize ()).c_str ());
3485
- OutputDebugString (L" Args Width:" );
3486
- OutputDebugString (std::to_wstring (args.Width ()).c_str ());
3487
- OutputDebugString (L" Composition Scale X:" );
3488
- OutputDebugString (std::to_wstring (dpiScale).c_str ());
3489
-
3490
- // QuickFixButton().Width(args.Width() / dpiScale);
3491
- QuickFixIcon ().FontSize (args.Width () / dpiScale);
3457
+ auto quickFixBtn = QuickFixButton ();
3458
+ quickFixBtn.Height (args.Height () / dpiScale);
3459
+ QuickFixIcon ().FontSize (std::min (static_cast <double >(args.Width () / dpiScale), GetPadding ().Left ));
3460
+ if (quickFixBtn.Visibility () == Visibility::Visible)
3461
+ {
3462
+ ShowQuickFixMenu ();
3463
+ }
3492
3464
}
3493
3465
3494
3466
void TermControl::_coreRaisedNotice (const IInspectable& /* sender*/ ,
@@ -3763,22 +3735,31 @@ namespace winrt::Microsoft::Terminal::Control::implementation
3763
3735
_showContextMenuAt (_toControlOrigin (cursorPos));
3764
3736
}
3765
3737
3738
+ double TermControl::CalculateQuickFixButtonWidth ()
3739
+ {
3740
+ return GetPadding ().Left ;
3741
+ }
3742
+
3743
+ double TermControl::CalculateQuickFixButtonCollapsedWidth ()
3744
+ {
3745
+ return GetPadding ().Left / 3.0 ;
3746
+ }
3747
+
3766
3748
void TermControl::ShowQuickFixMenu ()
3767
3749
{
3768
3750
auto quickFixBtn{ QuickFixButton () };
3769
3751
3770
3752
// If the gutter is narrow, display the collapsed version
3771
- const auto & termPadding = SwapChainPanel (). Margin ();
3753
+ const auto & termPadding = GetPadding ();
3772
3754
3773
- _quickFixButtonCollapsible = termPadding.Left < 16 ;
3755
+ _quickFixButtonCollapsible = termPadding.Left < CharacterDimensions (). Width ;
3774
3756
VisualStateManager::GoToState (*this , !_quickFixButtonCollapsible ? StateNormal : StateCollapsed, false );
3775
3757
3776
3758
// draw the button in the gutter
3777
3759
Controls::Canvas::SetLeft (quickFixBtn, -termPadding.Left );
3778
3760
3779
- // TODO CARLOS: update for dpi?
3780
3761
const auto & cursorPosInDips = CursorPositionInDips ();
3781
- Controls::Canvas::SetTop (quickFixBtn, cursorPosInDips.Y - termPadding. Top );
3762
+ Controls::Canvas::SetTop (quickFixBtn, cursorPosInDips.Y );
3782
3763
quickFixBtn.Visibility (Visibility::Visible);
3783
3764
}
3784
3765
0 commit comments