aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reline/line_editor.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-07-06 12:11:12 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-07-06 12:11:12 +0900
commit44aae5fee666e6767415c214e25e90f6ad565550 (patch)
treefd3ffc67dee2ed433b1cba068460ffd70c510287 /lib/reline/line_editor.rb
parent833cfeb2260c460d05c75cc6d16fa992d881ec54 (diff)
downloadruby-44aae5fee666e6767415c214e25e90f6ad565550.tar.gz
Simplified
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r--lib/reline/line_editor.rb9
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 62965d0662..6bcfb4b5cc 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -136,14 +136,7 @@ class Reline::LineEditor
end
private def calculate_height_by_width(width)
- return 1 if width.zero?
- height = 1
- max_width = @screen_size.last
- while width > max_width * height
- height += 1
- end
- height += 1 if (width % max_width).zero?
- height
+ width.div(@screen_size.last) + 1
end
private def split_by_width(prompt, str, max_width)