Skip to content

Commit

Permalink
Fix zero division when the screen width is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Oct 11, 2021
1 parent 1a46678 commit 0dce9da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/reline/line_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ def multiline_off
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)
Expand Down

0 comments on commit 0dce9da

Please sign in to comment.