summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2018-03-27 10:45:33 +0200
committerJosé Valim <jose.valim@plataformatec.com.br>2018-03-27 10:46:59 +0200
commit91e8a76bfb5f064bd28b15e85f4ac5e84848b2b5 (patch)
tree929385c41a0b0a86cb72f563cb8cb2633ef86cb8
parentf64f9571678a08d2416ac0caaf0ca8592300c893 (diff)
downloadelixir-91e8a76bfb5f064bd28b15e85f4ac5e84848b2b5.tar.gz
Fix swapped cursor_left and cursor_right
Closes #7496.
-rw-r--r--lib/elixir/lib/io/ansi.ex10
-rw-r--r--lib/elixir/test/elixir/io/ansi_test.exs8
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/elixir/lib/io/ansi.ex b/lib/elixir/lib/io/ansi.ex
index 76543feb0..2715e0520 100644
--- a/lib/elixir/lib/io/ansi.ex
+++ b/lib/elixir/lib/io/ansi.ex
@@ -189,13 +189,13 @@ defmodule IO.ANSI do
@spec cursor_down(pos_integer) :: String.t()
def cursor_down(lines \\ 1) when is_integer(lines) and lines >= 1, do: "\e[#{lines}B"
- @doc "Sends cursor `columns` to the left."
- @spec cursor_left(pos_integer) :: String.t()
- def cursor_left(columns \\ 1) when is_integer(columns) and columns >= 1, do: "\e[#{columns}C"
-
@doc "Sends cursor `columns` to the right."
@spec cursor_right(pos_integer) :: String.t()
- def cursor_right(columns \\ 1) when is_integer(columns) and columns >= 1, do: "\e[#{columns}D"
+ def cursor_right(columns \\ 1) when is_integer(columns) and columns >= 1, do: "\e[#{columns}C"
+
+ @doc "Sends cursor `columns` to the left."
+ @spec cursor_left(pos_integer) :: String.t()
+ def cursor_left(columns \\ 1) when is_integer(columns) and columns >= 1, do: "\e[#{columns}D"
@doc "Clears screen."
defsequence(:clear, "2", "J")
diff --git a/lib/elixir/test/elixir/io/ansi_test.exs b/lib/elixir/test/elixir/io/ansi_test.exs
index bb081e9ab..81d5bfc88 100644
--- a/lib/elixir/test/elixir/io/ansi_test.exs
+++ b/lib/elixir/test/elixir/io/ansi_test.exs
@@ -196,8 +196,8 @@ defmodule IO.ANSITest do
end
test "cursor_left/1" do
- assert IO.ANSI.cursor_left() == "\e[1C"
- assert IO.ANSI.cursor_left(3) == "\e[3C"
+ assert IO.ANSI.cursor_left() == "\e[1D"
+ assert IO.ANSI.cursor_left(3) == "\e[3D"
assert_raise FunctionClauseError, fn ->
IO.ANSI.cursor_left(0)
@@ -209,8 +209,8 @@ defmodule IO.ANSITest do
end
test "cursor_right/1" do
- assert IO.ANSI.cursor_right() == "\e[1D"
- assert IO.ANSI.cursor_right(4) == "\e[4D"
+ assert IO.ANSI.cursor_right() == "\e[1C"
+ assert IO.ANSI.cursor_right(4) == "\e[4C"
assert_raise FunctionClauseError, fn ->
IO.ANSI.cursor_right(0)