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
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Widgets
|
module Widgets
|
||||||
|
using Helpers
|
||||||
|
|
||||||
class Menu < Base
|
class Menu < Base
|
||||||
def trigger(event)
|
def trigger(event)
|
||||||
case event
|
case event
|
||||||
|
@ -48,11 +50,7 @@ module Widgets
|
||||||
end,
|
end,
|
||||||
window,
|
window,
|
||||||
) do
|
) do
|
||||||
if friend[:name].length <= props[:width] - 2
|
addstr friend[:name].ljustetc props[:width] - 2
|
||||||
addstr friend[:name].ljust props[:width] - 2
|
|
||||||
else
|
|
||||||
addstr "#{friend[:name][0...props[:width] - 5]}..."
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue