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 Jan 30, 2020
1 parent 46aae81 commit 1b45119
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 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 @@ -100,7 +98,6 @@ Profile::Profile(const std::optional<GUID>& guid) :
_defaultForeground{},
_defaultBackground{},
_selectionBackground{},
_colorTable{},
_tabTitle{},
_suppressApplicationTitle{},
_historySize{ DEFAULT_HISTORY_SIZE },
Expand Down Expand Up @@ -166,11 +163,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.CursorColor(_cursorColor);
Expand Down Expand Up @@ -293,15 +285,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;
root[JsonKey(CursorColorKey)] = Utils::ColorToHexString(_cursorColor);
Expand Down Expand Up @@ -634,26 +617,7 @@ void Profile::LayerJson(const Json::Value& json)
JsonUtils::GetOptionalColor(json, SelectionBackgroundKey, _selectionBackground);

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++;
}
}
if (json.isMember(JsonKey(HistorySizeKey)))
{
auto historySize{ json[JsonKey(HistorySizeKey)] };
Expand Down

0 comments on commit 1b45119

Please sign in to comment.