# Curses about libcurse

**URL:** <https://www.ruby-forum.com/t/curses-about-libcurse/51830>\
**Category:** Ruby\
**Created:** [December 3, 2005, 3:43am UTC](https://www.ruby-forum.com/t/curses-about-libcurse/51830 "2005-12-03T03:43:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 3, 2005, 3:43am UTC](https://www.ruby-forum.com/t/curses-about-libcurse/51830/1 "2005-12-03T03:43:58Z")

</div>

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

> **[oree.ch](http://zimba.oree.ch)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 3, 2005, 6:22am UTC](https://www.ruby-forum.com/t/curses-about-libcurse/51830/2 "2005-12-03T06:22:48Z")

</div>

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/](http://raa.ruby-lang.org/project/ncurses-ruby/)

Tsume

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 3, 2005, 7:52am UTC](https://www.ruby-forum.com/t/curses-about-libcurse/51830/3 "2005-12-03T07:52:37Z")

</div>

[http://rubyforge.org/projects/rush](http://rubyforge.org/projects/rush)

would benefit greatly from some sort of improved text library

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 3, 2005, 7:22pm UTC](https://www.ruby-forum.com/t/curses-about-libcurse/51830/4 "2005-12-03T19:22:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 3, 2005, 7:38pm UTC](https://www.ruby-forum.com/t/curses-about-libcurse/51830/5 "2005-12-03T19:38:42Z")

</div>

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](http://www.ruby-doc.org/stdlib/libdoc/curses/rdoc/classes/Curses.html)

On 03/12/05, Richard L. [removed\_email\_address@domain.invalid](mailto: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

> **[oree.ch](http://zimba.oree.ch)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 4, 2005, 1:35pm UTC](https://www.ruby-forum.com/t/curses-about-libcurse/51830/6 "2005-12-04T13:35:07Z")

</div>

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 !

---

<div class="post-metadata">

**Author:** ![zimba.tm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zimba.tm](https://www.ruby-forum.com/u/zimba.tm)\
**Post date:** [December 3, 2005, 7:22pm UTC](https://www.ruby-forum.com/t/curses-about-libcurse/51830/7 "2005-12-03T19:22:28Z")

</div>

On 03/12/05, Reyn V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [http://rubyforge.org/projects/rush](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/](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

> **[oree.ch](http://zimba.oree.ch)**
>
> This domain may be for sale!
