Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #247 from DamienRobert/formatting-bug
Browse files Browse the repository at this point in the history
Fix a bug in formatting.rb
  • Loading branch information
AlexChesters committed Oct 16, 2015
2 parents 44ba7cf + 7a4bd52 commit 257375e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ghi/formatting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def paging?

def truncate string, reserved
return string unless paginate?
result = string.scan(/.{0,#{columns - reserved}}(?:\s|\Z)/).first.strip
space=columns - reserved
space=5 if space < 5
result = string.scan(/.{0,#{space}}(?:\s|\Z)/).first.strip
result << "..." if result != string
result
end
Expand Down

0 comments on commit 257375e

Please sign in to comment.