summaryrefslogtreecommitdiff
path: root/lib/highline/wrapper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/highline/wrapper.rb')
-rw-r--r--lib/highline/wrapper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/highline/wrapper.rb b/lib/highline/wrapper.rb
index 4b17666..a2ab4ac 100644
--- a/lib/highline/wrapper.rb
+++ b/lib/highline/wrapper.rb
@@ -25,7 +25,8 @@ class HighLine
while line =~ /([^\n]{#{wrap_at + 1},})/
search = Regexp.last_match(1).dup
replace = Regexp.last_match(1).dup
- if index = replace.rindex(" ", wrap_at)
+ index = replace.rindex(" ", wrap_at)
+ if index
replace[index, 1] = "\n"
replace.sub!(/\n[ \t]+/, "\n")
line.sub!(search, replace)