Curses about libcurse


#1

Hello,

I hate curses. Not that much, but it’s really not that easy to build
ruby console applications using it.

Are there other libraries I could use instead of libcurses ?

My main complains are :

  • you can’t access the screen like a character matrix
  • i want callbacks (onresize)
  • you need to move the cursor where you want to write
  • the "window"ing system is not cool
  • it really feels like an old-skool C library in ruby

I started overriding the curses library to implement what I think is
nicer (which is subjective). Is anybody interested in this ? Also,
what is so special in the libcurse ? Is it because it supports VT100
that people are still using it ?

The joined file containes the modified curses class plus an class that
demonstrates how to use it (however it doesn’t run)


Cheers,
zimba

http://zimba.oree.ch


#2

On Saturday 03 December 2005 11:40 am, zimba-tm wrote:

Hello,

I hate curses. Not that much, but it’s really not that easy to build
ruby console applications using it.

Join the club

Are there other libraries I could use instead of libcurses ?

http://raa.ruby-lang.org/project/ncurses-ruby/

Tsume


#3

http://rubyforge.org/projects/rush

would benefit greatly from some sort of improved text library


#4

Is there something specifically that you’ve been trying to do but
couldn’t?

Is it just the quality or speed of development that is annoying you?

I ask only because I’m thinking about writing an Ncurses app, so feel
free to ‘dump’.

-Rich


#5

Hi Richard,

in brief, you can do anything with curses. You can write text on the
whole screen, use colors, the mouse. So it’s not about technical
missing features.

However, the library makes it hard to do some things. First of all,
the library is seriously lacking in documentation. Just take a look to
the curses stdlib rdoc[1] to have an idea. I couldn’t go really
further without looking at the provided examples.

Curses integrates a concept of windows. You set a window with top,
left, width and height. Then everything you write inside won’t get out
of that box and it can be scrolled. The idea is pretty neat, but it
suffers some limitations. Because you don’t have callbacks, you have
to make a loop to track the different changes (like mouse moves and
term resizes). And because it’s not well documented, I found it was
hard to have consistent behavior.

It takes much too long to write a simple GUI.

[1]
http://www.ruby-doc.org/stdlib/libdoc/curses/rdoc/classes/Curses.html

On 03/12/05, Richard L. removed_email_address@domain.invalid wrote:

Is there something specifically that you’ve been trying to do but couldn’t?

Is it just the quality or speed of development that is annoying you?

I ask only because I’m thinking about writing an Ncurses app, so feel
free to ‘dump’.

-Rich


Cheers,
zimba

http://zimba.oree.ch


#6

Oh, I missed the replies.

The biggest issue with ruSH is that obviously we need to run existing
console binaries on it.
I ran into issues with things like vi etc. I needed to exit curses
before
entering vi, or vi would moan and/or break. That made me introduce the ^
character for all the things that needed to exit curses. (eg. ^vi)

Other commands like say for instance ‘ls’ needs to be run with popen4
which
grabs the output and writes it to the curses screen, so anything that
needs
input immediately hangs.

The other thing is that something like ls --color emits color codes,
it’s
been a while since I worked on this so my minds a bit sketchy. I was
having
issues with the number of colors I could define and the fact that if I
change a color it changes all the colors with that number on the screen

errrm, so what I basically need is for curses and the console apps to
play
together nicely, surely it’s possible ?

Tell me if you cant get ruSH running to look at it, it’s quite a mission
at
the moment :-o

We … I need a next gen shell !


#7

On 03/12/05, Reyn V. removed_email_address@domain.invalid wrote:

http://rubyforge.org/projects/rush

would benefit greatly from some sort of improved text library

Maybe we can work on something. I looked at rush some time ago and it
looked really promising.

Are there other libraries I could use instead of libcurses ?

http://raa.ruby-lang.org/project/ncurses-ruby/

Thanks for your reply.

The links on that page are not accessible to me. Are you part of that
“club” ?

Tsume


Reyn V.


Cheers,
zimba

http://zimba.oree.ch