[前][次][番号順一覧][スレッド一覧]

ruby-changes:56375

From: Nobuyoshi <ko1@a...>
Date: Sat, 6 Jul 2019 12:22:16 +0900 (JST)
Subject: [ruby-changes:56375] Nobuyoshi Nakada: 44aae5fee6 (master): Simplified

https://git.ruby-lang.org/ruby.git/commit/?id=44aae5fee6

From 44aae5fee666e6767415c214e25e90f6ad565550 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 6 Jul 2019 12:11:12 +0900
Subject: Simplified


diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 62965d0..6bcfb4b 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -136,14 +136,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L136
   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)
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]