summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-07-01 21:14:50 +0900
committeraycabta <aycabta@gmail.com>2019-07-01 21:14:50 +0900
commit76851381cb18a62f3a75720f868ac147e4c1c51c (patch)
tree15bac22a15a6e75a0f174e84e00c7a67ad2a9b40
parent90c51ca39170030b2ea0611bcbb435b76915a287 (diff)
Show "-" if indent level is negative
-rw-r--r--lib/irb.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/irb.rb b/lib/irb.rb
index 5ba0679501..caccb2bd30 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -670,10 +670,18 @@ module IRB
when "l"
ltype
when "i"
- if $1
- format("%" + $1 + "d", indent)
+ if indent < 0
+ if $1
+ "-".rjust($1.to_i)
+ else
+ "-"
+ end
else
- indent.to_s
+ if $1
+ format("%" + $1 + "d", indent)
+ else
+ indent.to_s
+ end
end
when "n"
if $1