Use String#ljustetc again
This commit is contained in:
parent
9fa94e5f0f
commit
2f07a142e8
1 changed files with 3 additions and 5 deletions
|
@ -1,6 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Widgets
|
||||
using Helpers
|
||||
|
||||
class Menu < Base
|
||||
def trigger(event)
|
||||
case event
|
||||
|
@ -48,11 +50,7 @@ module Widgets
|
|||
end,
|
||||
window,
|
||||
) do
|
||||
if friend[:name].length <= props[:width] - 2
|
||||
addstr friend[:name].ljust props[:width] - 2
|
||||
else
|
||||
addstr "#{friend[:name][0...props[:width] - 5]}..."
|
||||
end
|
||||
addstr friend[:name].ljustetc props[:width] - 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Reference in a new issue