Skip to content

Commit

Permalink
Settings: remove legacy colorscheme key and colorTable
Browse files Browse the repository at this point in the history
Fixes #4091.
Refs #1069.
  • Loading branch information
DHowett committed Mar 30, 2020
1 parent 1be9feb commit e3bc5a9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
37 changes: 0 additions & 37 deletions src/cascadia/TerminalApp/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ static constexpr std::string_view NameKey{ "name" };
static constexpr std::string_view GuidKey{ "guid" };
static constexpr std::string_view SourceKey{ "source" };
static constexpr std::string_view ColorSchemeKey{ "colorScheme" };
static constexpr std::string_view ColorSchemeKeyOld{ "colorscheme" };
static constexpr std::string_view HiddenKey{ "hidden" };

static constexpr std::string_view ForegroundKey{ "foreground" };
static constexpr std::string_view BackgroundKey{ "background" };
static constexpr std::string_view SelectionBackgroundKey{ "selectionBackground" };
static constexpr std::string_view ColorTableKey{ "colorTable" };
static constexpr std::string_view TabTitleKey{ "tabTitle" };
static constexpr std::string_view SuppressApplicationTitleKey{ "suppressApplicationTitle" };
static constexpr std::string_view HistorySizeKey{ "historySize" };
Expand Down Expand Up @@ -105,7 +103,6 @@ Profile::Profile(const std::optional<GUID>& guid) :
_defaultBackground{},
_selectionBackground{},
_cursorColor{},
_colorTable{},
_tabTitle{},
_suppressApplicationTitle{},
_historySize{ DEFAULT_HISTORY_SIZE },
Expand Down Expand Up @@ -171,11 +168,6 @@ TerminalSettings Profile::CreateTerminalSettings(const std::unordered_map<std::w
TerminalSettings terminalSettings{};

// Fill in the Terminal Setting's CoreSettings from the profile
auto const colorTableCount = gsl::narrow_cast<int>(_colorTable.size());
for (int i = 0; i < colorTableCount; i++)
{
terminalSettings.SetColorTableEntry(i, _colorTable[i]);
}
terminalSettings.HistorySize(_historySize);
terminalSettings.SnapOnInput(_snapOnInput);
terminalSettings.CursorHeight(_cursorHeight);
Expand Down Expand Up @@ -308,15 +300,6 @@ Json::Value Profile::ToJson() const
const auto scheme = winrt::to_string(_schemeName.value());
root[JsonKey(ColorSchemeKey)] = scheme;
}
else
{
Json::Value tableArray{};
for (auto& color : _colorTable)
{
tableArray.append(Utils::ColorToHexString(color));
}
root[JsonKey(ColorTableKey)] = tableArray;
}
root[JsonKey(HistorySizeKey)] = _historySize;
root[JsonKey(SnapOnInputKey)] = _snapOnInput;
// Only add the cursor height property if we're a legacy-style cursor.
Expand Down Expand Up @@ -644,26 +627,6 @@ void Profile::LayerJson(const Json::Value& json)
JsonUtils::GetOptionalColor(json, CursorColorKey, _cursorColor);

JsonUtils::GetOptionalString(json, ColorSchemeKey, _schemeName);
// TODO:GH#1069 deprecate old settings key
JsonUtils::GetOptionalString(json, ColorSchemeKeyOld, _schemeName);

// Only look for the "table" if there's no "schemeName"
if (!(json.isMember(JsonKey(ColorSchemeKey))) &&
!(json.isMember(JsonKey(ColorSchemeKeyOld))) &&
json.isMember(JsonKey(ColorTableKey)))
{
auto colortable{ json[JsonKey(ColorTableKey)] };
int i = 0;
for (const auto& tableEntry : colortable)
{
if (tableEntry.isString())
{
const auto color = Utils::ColorFromHexString(tableEntry.asString());
_colorTable[i] = color;
}
i++;
}
}

// TODO:MSFT:20642297 - Use a sentinel value (-1) for "Infinite scrollback"
JsonUtils::GetInt(json, HistorySizeKey, _historySize);
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalApp/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ class TerminalApp::Profile final
std::optional<uint32_t> _defaultBackground;
std::optional<uint32_t> _selectionBackground;
std::optional<uint32_t> _cursorColor;
std::array<uint32_t, COLOR_TABLE_SIZE> _colorTable;
std::optional<std::wstring> _tabTitle;
bool _suppressApplicationTitle;
int32_t _historySize;
Expand Down

0 comments on commit e3bc5a9

Please sign in to comment.