mscdex / node-ncurses

An ncurses binding for node.js
MIT License
385 stars 25 forks source link

THIS MODULE IS NO LONGER BEING MAINTAINED. If you would like to become a maintainer, please submit an issue.

You may want to look at blessed as a better alternative to this module.

Description

node-ncurses is an ncurses binding for node.js.

Note: Mac OSX users may find themselves encountering bizarre output on their terminals in some situations. This is a known problem and basically requires more frequent Window.refresh()'ing to get everything to display properly.

Requirements

Terminology

Functions that accept window/screen coordinates use a "row, column" format.

Also, stdscr is the name of the first window that is created and fills the terminal/screen by default. It cannot be resized or moved, it is always the bottom-most window, and it is the window you get when you first create a new Window.

API Documentation

node-ncurses exposes only one class: Window.

Special data types

      var nc = require('ncurses'),
          win = new nc.Window();
      win.hline(nc.cols, nc.ACS.DIAMOND);

Module Functions


Module Properties

Window Events

Window Functions

Window Properties

Additional notes

Using ncurses with X

A resize operation in X sends SIGWINCH to the running application. The ncurses library does not catch this signal, because it cannot in general know how you want the screen re-painted. You will have to write the SIGWINCH handler yourself.

At minimum, your SIGWINCH handler should do a clearok(), followed by a refresh() on each of your windows.

ACS_Character descriptions

Character Name   POSIX Default  Description
--------------   -------------  -----------
ULCORNER              +         upper left-hand corner
LLCORNER              +         lower left-hand corner
URCORNER              +         upper right-hand corner
LRCORNER              +         lower right-hand corner
RTEE                  +         right tee
LTEE                  +         left tee
BTEE                  +         bottom tee
TTEE                  +         top tee
HLINE                 -         horizontal line
VLINE                 |         vertical line
PLUS                  +         plus
S1                    -         scan line 1
S9                    _         scan line 9
DIAMOND               +         diamond
CKBOARD               :         checker board (stipple)
DEGREE                '         degree symbol
PLMINUS               #         plus/minus
BULLET                o         bullet
LARROW                <         arrow pointing left
RARROW                >         arrow pointing right
DARROW                v         arrow pointing down
UARROW                ^         arrow pointing up
BOARD                 #         board of squares
LANTERN               #         lantern symbol
BLOCK                 #         solid square block

Keyboard key names

Keys prefixed with 'S_' denote SHIFT + the key.