Skip to content

Commit e3c6cc9

Browse files
committed
IEx's h helper should not render ANSI codes in the documentation
pieces, otherwise it becomes impossible to read IO.ANSI documentation
1 parent c78c8dd commit e3c6cc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/iex/lib/iex/introspection.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defmodule IEx.Introspection do
1010
case module.__info__(:moduledoc) do
1111
{ _, binary } when is_binary(binary) ->
1212
IO.puts IO.ANSI.escape("%{yellow}# #{inspect module}\n")
13-
IO.write IO.ANSI.escape("%{yellow}#{binary}")
13+
IO.write IO.ANSI.escape_fragment("%{yellow}") <> binary <> IO.ANSI.escape_fragment("%{reset}")
1414
{ _, _ } ->
1515
IO.puts IO.ANSI.escape("%{red}No docs for #{inspect module} have been found")
1616
_ ->
@@ -148,7 +148,7 @@ defmodule IEx.Introspection do
148148
defp print_doc({ { fun, _ }, _line, kind, args, doc }) do
149149
args = Enum.map_join(args, ", ", print_doc_arg(&1))
150150
IO.puts IO.ANSI.escape("%{yellow}* #{kind} #{fun}(#{args})\n")
151-
IO.write IO.ANSI.escape("%{yellow}#{doc}")
151+
IO.write IO.ANSI.escape_fragment("%{yellow}") <> doc <> IO.ANSI.escape_fragment("%{reset}")
152152
end
153153

154154
defp print_doc_arg({ ://, _, [left, right] }) do

0 commit comments

Comments
 (0)