@@ -1416,21 +1416,24 @@ namespace winrt::TerminalApp::implementation
1416
1416
{
1417
1417
if (const auto terminalTab{ _GetFocusedTabImpl () })
1418
1418
{
1419
- uint32_t realRowsToScroll;
1420
- if (rowsToScroll == nullptr )
1419
+ if (const auto & termControl{ terminalTab->GetActiveTerminalControl () })
1421
1420
{
1422
- // The magic value of WHEEL_PAGESCROLL indicates that we need to scroll the entire page
1423
- realRowsToScroll = _systemRowsToScroll == WHEEL_PAGESCROLL ?
1424
- terminalTab->GetActiveTerminalControl ().ViewHeight () :
1425
- _systemRowsToScroll;
1426
- }
1427
- else
1428
- {
1429
- // use the custom value specified in the command
1430
- realRowsToScroll = rowsToScroll.Value ();
1421
+ uint32_t realRowsToScroll;
1422
+ if (rowsToScroll == nullptr )
1423
+ {
1424
+ // The magic value of WHEEL_PAGESCROLL indicates that we need to scroll the entire page
1425
+ realRowsToScroll = _systemRowsToScroll == WHEEL_PAGESCROLL ?
1426
+ termControl.ViewHeight () :
1427
+ _systemRowsToScroll;
1428
+ }
1429
+ else
1430
+ {
1431
+ // use the custom value specified in the command
1432
+ realRowsToScroll = rowsToScroll.Value ();
1433
+ }
1434
+ auto scrollDelta = _ComputeScrollDelta (scrollDirection, realRowsToScroll);
1435
+ terminalTab->Scroll (scrollDelta);
1431
1436
}
1432
- auto scrollDelta = _ComputeScrollDelta (scrollDirection, realRowsToScroll);
1433
- terminalTab->Scroll (scrollDelta);
1434
1437
}
1435
1438
}
1436
1439
@@ -2093,8 +2096,10 @@ namespace winrt::TerminalApp::implementation
2093
2096
if (warnMultiLine)
2094
2097
{
2095
2098
const auto focusedTab = _GetFocusedTabImpl ();
2099
+ const auto & termControl{ focusedTab->GetActiveTerminalControl () };
2096
2100
// Do not warn about multi line pasting if the current tab has bracketed paste enabled.
2097
- warnMultiLine = warnMultiLine && !focusedTab->GetActiveTerminalControl ().BracketedPasteEnabled ();
2101
+ warnMultiLine = warnMultiLine &&
2102
+ (termControl && !termControl.BracketedPasteEnabled ());
2098
2103
}
2099
2104
2100
2105
// We have to initialize the dialog here to be able to change the text of the text block within it
@@ -2402,11 +2407,14 @@ namespace winrt::TerminalApp::implementation
2402
2407
// TODO GH#5047 If we cache the NewTerminalArgs, we no longer need to do this.
2403
2408
profile = GetClosestProfileForDuplicationOfProfile (profile);
2404
2409
controlSettings = TerminalSettings::CreateWithProfile (_settings, profile, *_bindings);
2405
- const auto workingDirectory = focusedTab->GetActiveTerminalControl ().WorkingDirectory ();
2406
- const auto validWorkingDirectory = !workingDirectory.empty ();
2407
- if (validWorkingDirectory)
2410
+ if (const auto & control{ focusedTab->GetActiveTerminalControl () })
2408
2411
{
2409
- controlSettings.DefaultSettings ().StartingDirectory (workingDirectory);
2412
+ const auto workingDirectory = control.WorkingDirectory ();
2413
+ const auto validWorkingDirectory = !workingDirectory.empty ();
2414
+ if (validWorkingDirectory)
2415
+ {
2416
+ controlSettings.DefaultSettings ().StartingDirectory (workingDirectory);
2417
+ }
2410
2418
}
2411
2419
}
2412
2420
}
0 commit comments