ruby-changes:68392
From: Nobuyoshi <ko1@a...>
Date: Tue, 12 Oct 2021 00:40:44 +0900 (JST)
Subject: [ruby-changes:68392] 60689f0f20 (master): [ruby/reline] Fix zero division when the screen width is not available
https://git.ruby-lang.org/ruby.git/commit/?id=60689f0f20 From 60689f0f20cf54ea85aea6ec7e07e3b8bb7c7119 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 11 Oct 2021 20:34:55 +0900 Subject: [ruby/reline] Fix zero division when the screen width is not available https://github.com/ruby/reline/commit/0dce9da083 --- lib/reline/line_editor.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index f6facc9da8..c1bb49033a 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -340,7 +340,8 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L340 end private def calculate_height_by_width(width) - width.div(@screen_size.last) + 1 + max_width = @screen_size.last + max_width > 0 ? (width.div(max_width) + 1) : 1 end private def split_by_width(str, max_width) -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/