Closed yart closed 3 years ago
Hi Artёm 👋
Thanks for trying tty
gem out.
I do prefer unicorn-display_width
name to unicode-display_width
, way cooler!
I must admit the tty
gem is horribly out of date. But, all the tty
components have been updated so please could you use the master branch for now to generate a CLI app? I will make a new release soon.
Having said that, in your CLI tool you should not depend on tty
gem. It is only used to generate a new app but shouldn't be required. Instead, if you wish to use any tty
gems please install and require them directly. See the full list of tty components.
So, in your case do:
require "tty-cursor"
cursor = TTY::Cursor
cursor.invisible do
# some code
end
Hope this helps.
Hi Piotr!
Thanks for your advice. I didn't read it before I tried to put the following string to my Gemfile and did 'bundle update':
gem "unicode-display_width", ">= 2.0.0"
So the gems were updated and the trouble was fixed but I think the advice makes sense because my other app hasn't had the same trouble when I used only a part of ‘tty’ at it as you advised.
Good point, I'll look through dependencies to ensure that the latest unicode-display_width
is supported. For now, I'd relax the requirement to something like this:
gem "unicode-display_width", ">= 1.6", "< 3.0"
With this change all tty
gems should be compatible. That's exactly what I've used in tty-progressbar. There is no difference between 1.7.0
and 2.0.0
of unicode-display_width
when it comes to Unicode support. There is an API change that doesn't extend the String class by default.
I gave follows when installed gem tty:
Sample of code:
My environment