does not work on 1.8
hramrach opened this issue · 12 comments
the description on rubygems.org: Ruby curses/ncurses widgets for easy application development on text terminals (ruby 1.9, 1.8)
On 1.8 I get many errors due to language incompatibility.
Obviously that is no longer true. rbcurse is definitely 1.9 only.
I just tried installing rbcurse-core on 1.8 and i could not install ffi which is a dependency. It gives errors on AbstractMemory.c. My gem list in 1.8 had rbcurse (which is the precursor to core), It used ncurses-ruby which is very hard to install on many systems.
Please let me know if ffi and ffi-ncurses install on your system. If so, what is your environment. (I tried with 1.8.7-p302 on OSX Mountain Lion). Otherwise, I will have to post an issue with the ffi gem.
ffi-ncurses installs fine for me on Debian Wheezy 1.8.7p358 and win32
1.8.7p330.
okay, I am installing the latest 1.8.7. If you can, please send me a copy of the errors in the meantime, so I can see the feasability. Thx.
Yes, I am getting a bunch of errors such as constants and now a downcase
error. Will see for a while how many i can fix.
I am dealing with most of them. Let's see how it goes. Maybe by tomorrow the samples will all be running. I've got a few of them running already.
got most of the errors fixed (see pull request) but a few remain:
$ ruby1.8 -rubygems -I ../lib/ bline.rb
========== EXCEPTION ==========
#<NoMethodError: undefined method `module_eval' for
#RubyCurses::CommandWindow:0x7f353ddd3a28>
/usr/lib/ruby/1.8/forwardable.rb:148:in def_instance_delegator' /usr/lib/ruby/1.8/forwardable.rb:132:in
def_delegators'
/usr/lib/ruby/1.8/forwardable.rb:131:in each' /usr/lib/ruby/1.8/forwardable.rb:131:in
def_delegators'
../lib/rbcurse/core/util/rcommandwindow.rb:45:in initialize' ../lib/rbcurse/core/util/bottomline.rb:1658:in
new'
../lib/rbcurse/core/util/bottomline.rb:1658:in display_list' bline.rb:18:in
testdisplay_list'
bline.rb:134
../lib/rbcurse/core/widgets/rwidget.rb:51:in instance_eval' ../lib/rbcurse/core/widgets/rwidget.rb:51:in
yield_or_eval'
../lib/rbcurse/core/util/app.rb:1027:in run' ../lib/rbcurse/core/util/app.rb:957:in
catch'
../lib/rbcurse/core/util/app.rb:957:in run' ../lib/rbcurse/core/util/app.rb:98:in
initialize'
bline.rb:51:in `new'
bline.rb:51
dbdemo fails to open database.
no demo database supplied?
nil can't be coerced into Fixnum
../lib/rbcurse/core/widgets/tabularwidget.rb:694:in +' ../lib/rbcurse/core/widgets/tabularwidget.rb:694:in
truncate'
../lib/rbcurse/core/widgets/tabularwidget.rb:725:in print_header' ../lib/rbcurse/core/widgets/tabularwidget.rb:634:in
paint'
../lib/rbcurse/core/widgets/tabularwidget.rb:413:in repaint' ../lib/rbcurse/core/widgets/rwidget.rb:1386:in
repaint'
../lib/rbcurse/core/widgets/rwidget.rb:1382:in each' ../lib/rbcurse/core/widgets/rwidget.rb:1382:in
repaint'
../lib/rbcurse/core/widgets/rwidget.rb:1890:in handle_key' ../lib/rbcurse/core/util/app.rb:166:in
loop'
../lib/rbcurse/core/util/app.rb:147:in catch' ../lib/rbcurse/core/util/app.rb:147:in
loop'
../lib/rbcurse/core/util/app.rb:1029:in run' ../lib/rbcurse/core/util/app.rb:957:in
catch'
../lib/rbcurse/core/util/app.rb:957:in run' ../lib/rbcurse/core/util/app.rb:98:in
initialize'
tabular.rb:3:in `new'
tabular.rb:3
I have also fixed all the issues including the reason why color-formatting is not working -- since I am using string[n] to give index instead of string[n,1].
However, i have not yet fixed the alpmenu.rb issues -- will check your request to see what you've done -- in any case that is demo code (method taking 2 blocks).
I am also not sure in how many other places there is string[n] which may not give an error but will just not give correct result.
Your fixes are almost similar to mine. There are 2 places where "encode" is giving an error and I checked for respond_to? :encode
in both places.
In the case of @description[n]
giving an error I have changed that to a hash i/o an array. I am puzzled how it was working earlier -- have to examine it again to figure out whether your fix is correct or mine.
Did not come across combo error. Maybe did not check some example.
In case of error in commandwindow.rb (forwardable) I have put the 3 methods as-is and commented off the def_delegator line.
I've added getbyte
to String if its 1.8.7 in rwidget.rb -- slightly different from your approach, just where i have monkey-patched Fixnum.
I will start merging in the changes.
I am also worried that the fix for BOLD may cause problems in 1.9 (some kind of repeated assignment to a constant)
Yes, some of the workarounds are not nice.
The string monkeypatching is not very friendly to random users of the
library. The function does the same as it weould on 1.9 but is not supposed
to be on 1.8.
Just wanted to clear the easy parts so that the more fundamental issues
remain if any.
If nothing else comes up, I will release this as a new version 0.0.9 in a couple hours.
works much better now.
thanks