Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp (C++)

Code before:
// Arguments:
// - <none>
// Return Value:
// - True if OS supports default terminal. False otherwise.
bool CascadiaSettings::IsDefaultTerminalAvailable() noexcept
{
    // Cached on first use since the OS version shouldn't change while we're running.
    static bool isAvailable = _isOnBuildWithDefTerm();
    return isAvailable;
}

// Method Description:
// - Returns an iterable collection of all available terminals.
// Arguments:
// - <none>
// Return Value:
// - an iterable collection of all available terminals that could be the default.
IObservableVector<Settings::Model::DefaultTerminal> CascadiaSettings::DefaultTerminals() const noexcept
{
    return _defaultTerminals;
}

// Method Description:
// - Returns the currently selected default terminal application.
// - DANGER! This will be null unless you've called
//   CascadiaSettings::RefreshDefaultTerminals. At te time of this comment (May
//   2021), only the Launch page in the settings UI calls that method, so this
//   value is unset unless you've navigated to that page.
// Arguments:
// - <none>
// Return Value:
// - the selected default terminal application
Settings::Model::DefaultTerminal CascadiaSettings::CurrentDefaultTerminal() const noexcept
{
    return _currentDefaultTerminal;
}

// Method Description:
// - Sets the current default terminal application
// Arguments:
// - terminal - Terminal from `DefaultTerminals` list to set as default
// Return Value:
// - <none>
void CascadiaSettings::CurrentDefaultTerminal(Settings::Model::DefaultTerminal terminal)
{
    _currentDefaultTerminal = terminal;
}


Review comment (suggestion):
```suggestion
//   CascadiaSettings::RefreshDefaultTerminals. At the time of this comment (May

```

Code after:
// Arguments:
// - <none>
// Return Value:
// - True if OS supports default terminal. False otherwise.
bool CascadiaSettings::IsDefaultTerminalAvailable() noexcept
{
    // Cached on first use since the OS version shouldn't change while we're running.
    static bool isAvailable = _isOnBuildWithDefTerm();
    return isAvailable;
}

// Method Description:
// - Returns an iterable collection of all available terminals.
// Arguments:
// - <none>
// Return Value:
// - an iterable collection of all available terminals that could be the default.
IObservableVector<Settings::Model::DefaultTerminal> CascadiaSettings::DefaultTerminals() const noexcept
{
    return _defaultTerminals;
}

// Method Description:
// - Returns the currently selected default terminal application.
// - DANGER! This will be null unless you've called
//   CascadiaSettings::RefreshDefaultTerminals. At the time of this comment (May

//   2021), only the Launch page in the settings UI calls that method, so this
//   value is unset unless you've navigated to that page.
// Arguments:
// - <none>
// Return Value:
// - the selected default terminal application
Settings::Model::DefaultTerminal CascadiaSettings::CurrentDefaultTerminal() const noexcept
{
    return _currentDefaultTerminal;
}

// Method Description:
// - Sets the current default terminal application
// Arguments:
// - terminal - Terminal from `DefaultTerminals` list to set as default
// Return Value:
// - <none>
void CascadiaSettings::CurrentDefaultTerminal(Settings::Model::DefaultTerminal terminal)
{
    _currentDefaultTerminal = terminal;
}