File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -151,8 +151,11 @@ defmodule IEx do
151
151
Registers options used on inspect.
152
152
"""
153
153
def inspect_opts(opts) when is_list(opts) do
154
- # FIXME: validate keys before setting
155
- :application.set_env(:iex, :inspect_opts, Keyword.merge(inspect_opts, opts))
154
+ old_opts = inspect_opts()
155
+ filtered_opts = Enum.filter opts, fn {name, _} ->
156
+ name in old_opts
157
+ end
158
+ :application.set_env(:iex, :inspect_opts, Keyword.merge(old_opts, filtered_opts))
156
159
end
157
160
158
161
@doc """
Original file line number Diff line number Diff line change @@ -123,8 +123,11 @@ defmodule IEx.Options do
123
123
124
124
def set ( :colors , colors ) when is_list ( colors ) do
125
125
{ :ok , old_colors } = :application . get_env ( :iex , :colors )
126
- # FIXME: validate keys before setting
127
- :application . set_env ( :iex , :colors , Keyword . merge ( old_colors , colors ) )
126
+ # Validate keys before setting
127
+ filtered_colors = Enum . filter colors , fn { name , _ } ->
128
+ name in old_colors
129
+ end
130
+ :application . set_env ( :iex , :colors , Keyword . merge ( old_colors , filtered_colors ) )
128
131
old_colors
129
132
end
130
133
@@ -134,7 +137,7 @@ defmodule IEx.Options do
134
137
135
138
def set ( :inspect , opts ) when is_list ( opts ) do
136
139
old_opts = IEx . inspect_opts
137
- # FIXME: validate keys before setting
140
+ # `opts` are validated by IEx.inspect_opts
138
141
IEx . inspect_opts ( opts )
139
142
old_opts
140
143
end
You can’t perform that action at this time.
0 commit comments