Class curses.window

Curses Window objects.

The methods documented on this page are available on any Curses Window object, such as created by:

stdscr = curses.initscr ()
window = curses.newwin (25, 80, 0, 0)

Methods

curses.window:addch (ch) Advance the cursor after writing a character at the old position.
curses.window:addchstr (chstr[, n]) Copy a curses.chstr starting at the current cursor position.
curses.window:addstr (str[, n]) Copy a Lua string starting at the current cursor position.
curses.window:attroff (attrs) Turn off the given attributes for subsequent writes to the window.
curses.window:attron (attrs) Turn on the given attributes for subsequent writes to the window.
curses.window:attrset (attrs) Set the given attributes for subsequent writes to the window.
curses.window:border ([ls[, rs[, ts[, bs[, tl[, tr[, bl[, br]]]]]]]]) Draw a border around a window.
curses.window:box (verch, horch) Draw a box around a window.
curses.window:clear () Call erase and then clearok.
curses.window:clearok (bf) The next call to refresh will clear and completely redraw the window.
curses.window:clone () Make a duplicate of a window.
curses.window:close () Free all the resources associated with a window.
curses.window:clrtobot () Write blanks to every character position after the cursor.
curses.window:clrtoeol () Write blanks from the cursor to the end of the current line.
curses.window:copywin (dst, st, sl, dt, dl, db, dr, overlay) Overlay a rectangle of this window over another.
curses.window:cursyncup () Mark cursor position of ancestors of a window for refresh.
curses.window:delch () Delete the character under the cursor.
curses.window:deleteln () Move the lines below the cursor up, to delete the current line.
curses.window:derive (nlines, ncols, begin_y, begin_x) Create a new derived window.
curses.window:echoch (ch) Call addch then refresh.
curses.window:erase () Write blanks to every character position in the window.
curses.window:getbegyx () Fetch the absolute top-left coordinates of a window.
curses.window:getbkgd () Fetch the current background attribute for the window.
curses.window:getch () Read a character from the window input.
curses.window:getmaxyx () Fetch the absolute bottom-right coordinates of a window.
curses.window:getparyx () Fetch the parent-relative coordinates of a subwindow.
curses.window:getstr ([n]) Read characters up to the next newline from the window input.
curses.window:getyx () Fetch the cursor position.
curses.window:hline (ch, n) Draw a row of characters from the current cursor position.
curses.window:idcok (bf) Use hardware character insert and delete on supporting terminals.
curses.window:idlok (bf) Use hardware line insert and delete on supporting terminals.
curses.window:immedok (bf) Automatically call refresh whenever the window content is changed.
curses.window:insertln () Move the current line and those below down one line, leaving a new blank line.
curses.window:intrflush (bf) Set the flush on interrupt behaviour for the window.
curses.window:is_linetouched (line) Has a particular window line changed since the last refresh?
curses.window:is_wintouched () Has a window changed since the last refresh?
curses.window:keypad ([on]) Set the single value keypad keys behaviour for the window.
curses.window:leaveok (bf) No need to force synchronisation of hardware cursor.
curses.window:meta (on) Force 8-bit (or 7-bit) input characters for the window.
curses.window:move (y, x) Change the cursor position.
curses.window:move_derived (par_y, par_x) Move the position of a derived window.
curses.window:move_window (y, x) Move the position of a window.
curses.window:mvaddch (y, x, ch) Call move, then addch.
curses.window:mvaddchstr (y, x[, n]) Call move then addchstr.
curses.window:mvaddstr (y, x, str[, n]) Call move then addstr.
curses.window:mvdelch (y, x) Call move then delch.
curses.window:mvgetch (y, x) Call move then getch
curses.window:mvgetstr (y, x[, n=-1]) Call move then getstr.
curses.window:mvhline (y, x, ch, n) Move the cursor, then draw a row of characters from the new cursor position.
curses.window:mvvline (y, x, ch, n) Move the cursor, then draw a column of characters from the new cursor position.
curses.window:mvwinch (y, x) Call move then winch
curses.window:mvwinchnstr (y, x, n) Call move then winchnstr.
curses.window:mvwinnstr (y, x, n) Call move then winnstr.
curses.window:mvwinsch (y, x, ch) Call move then winsch.
curses.window:mvwinsnstr (y, x, str, n) Call move then winsnstr.
curses.window:mvwinsstr (y, x, str) Call move then winsstr.
curses.window:nodelay (on) Force getch to be non-blocking.
curses.window:notimeout (bf) Return input immediately from this window.
curses.window:noutrefresh () Copy the window backing screen to the virtual screen.
curses.window:overlay (dst) Overlay this window on top of another non-destructively.
curses.window:overwrite (dst) Destructively overwrite another window with this one.
curses.window:pechochar (ch) An efficient equivalent to addch followed by refresh.
curses.window:pnoutrefresh (st, sl, dt, dl, db, dr) Equivalent to noutrefresh for use with pad windows.
curses.window:prefresh (st, sl, dt, dl, db, dr) Equivalent to refresh for use with pad windows.
curses.window:redrawln (beg_line, num_lines) Mark a range of lines in a window as corrupted and in need of redrawing.
curses.window:redrawwin () Mark a window as having corrupted display that needs fully redrawing.
curses.window:refresh () Refresh the window terminal display from the virtual screen.
curses.window:resize (height, width) Change the size of a window.
curses.window:scrl (n) Scroll the window up n lines.
curses.window:scrollok (bf) Scroll up one line when the cursor writes to the last screen position.
curses.window:standend () Turn off all attributes for subsequent writes to the window.
curses.window:standout () Set A_STANDOUT for subsequent writes to the window.
curses.window:sub (nlines, ncols, begin_y, begin_x) Create a new subwindow.
curses.window:subpad (nlines, ncols, begin_y, begin_x) Return a new subpad window object.
curses.window:syncdown () Mark child windows for refresh.
curses.window:syncok (bf) Automatically mark ancestors of a changed window for refresh.
curses.window:syncup () Mark ancestors of a window for refresh.
curses.window:timeout (delay) For differentiating user input from terminal control sequences.
curses.window:touch ([changed]) Set the changed state of a window since the last refresh.
curses.window:touchline (y, n[, changed]) Mark a range of lines as changed since the last refresh.
curses.window:vline (ch, n) Draw a column of characters from the current cursor position.
curses.window:wbkgd (ch) Call wbkgdset and then set the background of every position accordingly.
curses.window:wbkgdset (ch) Set the background attributes for subsequently written characters.
curses.window:winch () Fetch the attributed character at the current cursor position.
curses.window:winchnstr (n) Fetch attributed characters from cursor position up to rightmost window position.
curses.window:winnstr (n) Fetch a string from cursor position up to rightmost window position.
curses.window:winsch (ch) Insert an attributed character before the current cursor position.
curses.window:winsdelln (n) Call deleteln n times.
curses.window:winsnstr (str, n) Like winsstr, but no more than n characters.
curses.window:winsstr (str) Insert a string of characters before the current cursor position.
curses.window:wsetscrreg (top, bot) Set a software scrolling region for the window.

Metamethods

curses.window:__tostring () Unique string representation of a curses.window.


Methods

curses.window:addch (ch)
Advance the cursor after writing a character at the old position.

Parameters:

  • ch int

Returns:

    bool true, if successful

See also:

curses.window:addchstr (chstr[, n])
Copy a curses.chstr starting at the current cursor position.

Parameters:

  • chstr int cs
  • n int (optional)

Returns:

    bool true, if successful

See also:

curses.window:addstr (str[, n])
Copy a Lua string starting at the current cursor position.

Parameters:

Returns:

    bool true, if successful

See also:

curses.window:attroff (attrs)
Turn off the given attributes for subsequent writes to the window.

Parameters:

  • attrs int

Returns:

    bool true, if successful

See also:

curses.window:attron (attrs)
Turn on the given attributes for subsequent writes to the window.

Parameters:

  • attrs int

Returns:

    bool true, if successful

See also:

curses.window:attrset (attrs)
Set the given attributes for subsequent writes to the window.

Parameters:

  • attrs int

Returns:

    bool true, if successful

See also:

curses.window:border ([ls[, rs[, ts[, bs[, tl[, tr[, bl[, br]]]]]]]])
Draw a border around a window.

Parameters:

  • ls int (optional)
  • rs int (optional)
  • ts int (optional)
  • bs int (optional)
  • tl int (optional)
  • tr int (optional)
  • bl int (optional)
  • br int (optional)

Returns:

    bool true, if successful

See also:

Usage:

      win:border (curses.ACS_VLINE, curses.ACS_VLINE,
                  curses.ACS_HLINE, curses.ACS_HLINE,
    	      curses.ACS_ULCORNER, curses.ACS_URCORNER,
    	      curses.ACS_LLCORNER, curses.ACS_LRCORNER)
curses.window:box (verch, horch)
Draw a box around a window.

Parameters:

  • verch int
  • horch int

Returns:

    bool true, if successful

See also:

Usage:

    win:box (curses.ACS_VLINE, curses.ACS_HLINE)
curses.window:clear ()
Call erase and then clearok.

Returns:

    bool true, if successful

See also:

curses.window:clearok (bf)
The next call to refresh will clear and completely redraw the window.

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

curses.window:clone ()
Make a duplicate of a window.

Returns:

    window a new duplicate of this window

See also:

curses.window:close ()
Free all the resources associated with a window.

See also:

curses.window:clrtobot ()
Write blanks to every character position after the cursor.

Returns:

    bool true, if successful

See also:

curses.window:clrtoeol ()
Write blanks from the cursor to the end of the current line.

Returns:

    bool true, if successful

See also:

curses.window:copywin (dst, st, sl, dt, dl, db, dr, overlay)
Overlay a rectangle of this window over another.

Parameters:

  • dst window destination window
  • st int top row from this window
  • sl int left column from this window
  • dt int top row of rectangle
  • dl int left column of rectangle
  • db int bottom row of rectangle
  • dr int right column of rectangle
  • overlay bool if true, copy destructively like overlay

Returns:

    bool true, if successful

See also:

curses.window:cursyncup ()
Mark cursor position of ancestors of a window for refresh.

See also:

curses.window:delch ()
Delete the character under the cursor.

Returns:

    bool true, if successful

See also:

curses.window:deleteln ()
Move the lines below the cursor up, to delete the current line.

Returns:

    bool true, if successful

See also:

curses.window:derive (nlines, ncols, begin_y, begin_x)
Create a new derived window.

Parameters:

  • nlines int number of window lines
  • ncols int number of window columns
  • begin_y int top line of window
  • begin_x int leftmost column of window

Returns:

    window a new relatively positioned subwindow

See also:

curses.window:echoch (ch)
Call addch then refresh.

Parameters:

  • ch int

Returns:

    bool true, if successful

See also:

curses.window:erase ()
Write blanks to every character position in the window.

Returns:

    bool true, if successful

See also:

curses.window:getbegyx ()
Fetch the absolute top-left coordinates of a window.

Returns:

  1. int y coordinate of top line
  2. int x coordinate of left column
  3. bool true, if successful

See also:

curses.window:getbkgd ()
Fetch the current background attribute for the window.

Returns:

    int current window background attribute

See also:

curses.window:getch ()
Read a character from the window input.

Returns:

    int character read from input buffer

See also:

curses.window:getmaxyx ()
Fetch the absolute bottom-right coordinates of a window.

Returns:

  1. int y coordinate of bottom line
  2. int x coordinate of right column
  3. bool true, if successful

See also:

curses.window:getparyx ()
Fetch the parent-relative coordinates of a subwindow.

Returns:

  1. int y coordinate of top line relative to parent window
  2. int x coordinate of left column relative to parent window

See also:

curses.window:getstr ([n])
Read characters up to the next newline from the window input.

Parameters:

  • n int (optional)

Returns:

    string string read from input buffer

See also:

curses.window:getyx ()
Fetch the cursor position.

Returns:

  1. int y coordinate of top line
  2. int x coordinate of left column

See also:

curses.window:hline (ch, n)
Draw a row of characters from the current cursor position.

Parameters:

  • ch int
  • n int

Returns:

    bool true, if successful

See also:

Usage:

      _, width = win:getmaxyx ()
      win:hline (curses.ACS_HLINE, width - curs_x)
curses.window:idcok (bf)
Use hardware character insert and delete on supporting terminals.

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

curses.window:idlok (bf)
Use hardware line insert and delete on supporting terminals.

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

curses.window:immedok (bf)
Automatically call refresh whenever the window content is changed.

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

curses.window:insertln ()
Move the current line and those below down one line, leaving a new blank line.

Returns:

    bool true, if successful

See also:

curses.window:intrflush (bf)
Set the flush on interrupt behaviour for the window.

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

curses.window:is_linetouched (line)
Has a particular window line changed since the last refresh?

Parameters:

  • line int

Returns:

    bool true, if successful

See also:

curses.window:is_wintouched ()
Has a window changed since the last refresh?

Returns:

    bool true, if successful

See also:

curses.window:keypad ([on])
Set the single value keypad keys behaviour for the window.

Parameters:

  • on bool (optional)

Returns:

    bool true, if successful

See also:

curses.window:leaveok (bf)
No need to force synchronisation of hardware cursor.

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

curses.window:meta (on)
Force 8-bit (or 7-bit) input characters for the window.

Parameters:

  • on bool true to force 8-bit input characters

Returns:

    bool true, if successful

See also:

curses.window:move (y, x)
Change the cursor position.

Parameters:

  • y int
  • x int

Returns:

    bool true, if successful

See also:

curses.window:move_derived (par_y, par_x)
Move the position of a derived window.

Parameters:

  • par_y int lines from top of parent window
  • par_x int columns from left of parent window

Returns:

    bool true, if successful

See also:

curses.window:move_window (y, x)
Move the position of a window.

Parameters:

  • y int offset frow top of screen
  • x int offset from left of screen

Returns:

    bool true, if successful

See also:

curses.window:mvaddch (y, x, ch)
Call move, then addch.

Parameters:

  • y int
  • x int
  • ch int

Returns:

    bool true, if successful

See also:

curses.window:mvaddchstr (y, x[, n])
Call move then addchstr.

Parameters:

  • y int
  • x int
  • n int (optional)

Returns:

    bool true, if successful

See also:

curses.window:mvaddstr (y, x, str[, n])
Call move then addstr.

Parameters:

  • y int
  • x int
  • str string
  • n int (optional)

Returns:

    bool true, if successful

See also:

curses.window:mvdelch (y, x)
Call move then delch.

Parameters:

  • y int
  • x int

Returns:

    bool true, if successful

See also:

curses.window:mvgetch (y, x)
Call move then getch

Parameters:

  • y int
  • x int

Returns:

    int character read from input buffer

See also:

curses.window:mvgetstr (y, x[, n=-1])
Call move then getstr.

Parameters:

  • y int
  • x int
  • n int (default -1)

Returns:

    string string read from input buffer

See also:

curses.window:mvhline (y, x, ch, n)
Move the cursor, then draw a row of characters from the new cursor position.

Parameters:

  • y int
  • x int
  • ch int
  • n int

Returns:

    bool true, if successful

See also:

curses.window:mvvline (y, x, ch, n)
Move the cursor, then draw a column of characters from the new cursor position.

Parameters:

  • y int
  • x int
  • ch int
  • n int

Returns:

    bool true, if successful

See also:

curses.window:mvwinch (y, x)
Call move then winch

Parameters:

  • y int
  • x int

Returns:

    int attributed character read from input buffer

See also:

curses.window:mvwinchnstr (y, x, n)
Call move then winchnstr.

Parameters:

  • y int
  • x int
  • n int

Returns:

    curses.chstr characters from cursor to end of line

See also:

curses.window:mvwinnstr (y, x, n)
Call move then winnstr.

Parameters:

  • y int
  • x int
  • n int

Returns:

    string string read from input buffer

See also:

curses.window:mvwinsch (y, x, ch)
Call move then winsch.

Parameters:

  • y int
  • x int
  • ch int

Returns:

    bool true, if successful

See also:

curses.window:mvwinsnstr (y, x, str, n)
Call move then winsnstr.

Parameters:

  • y int
  • x int
  • str string
  • n int

Returns:

    bool true, if successful

See also:

curses.window:mvwinsstr (y, x, str)
Call move then winsstr.

Parameters:

Returns:

    bool true, if successful

See also:

curses.window:nodelay (on)
Force getch to be non-blocking.

Parameters:

  • on bool

Returns:

    bool true, if successful

See also:

curses.window:notimeout (bf)
Return input immediately from this window.

Parameters:

  • bf bool

Returns:

    bool true, if successful
curses.window:noutrefresh ()
Copy the window backing screen to the virtual screen.

Returns:

    bool true, if successful

See also:

curses.window:overlay (dst)
Overlay this window on top of another non-destructively.

Parameters:

  • dst window destination window

Returns:

    bool true, if successful

See also:

curses.window:overwrite (dst)
Destructively overwrite another window with this one.

Parameters:

  • dst window destination window

Returns:

    bool true, if successful

See also:

curses.window:pechochar (ch)
An efficient equivalent to addch followed by refresh.

Parameters:

  • ch int

Returns:

    bool true, if successful

See also:

curses.window:pnoutrefresh (st, sl, dt, dl, db, dr)
Equivalent to noutrefresh for use with pad windows.

Parameters:

  • st int top row from this pad window
  • sl int left column from this pad window
  • dt int top row of rectangle
  • dl int left column of rectangle
  • db int bottom row of rectangle
  • dr int right column of rectangle

Returns:

    bool true, if successful

See also:

curses.window:prefresh (st, sl, dt, dl, db, dr)
Equivalent to refresh for use with pad windows.

Parameters:

  • st int top row from this pad window
  • sl int left column from this pad window
  • dt int top row of rectangle
  • dl int left column of rectangle
  • db int bottom row of rectangle
  • dr int right column of rectangle

Returns:

    bool true, if successful

See also:

curses.window:redrawln (beg_line, num_lines)
Mark a range of lines in a window as corrupted and in need of redrawing.

Parameters:

  • beg_line int
  • num_lines int

Returns:

    bool true, if successful

See also:

curses.window:redrawwin ()
Mark a window as having corrupted display that needs fully redrawing.

Returns:

    bool true, if successful

See also:

curses.window:refresh ()
Refresh the window terminal display from the virtual screen.

Returns:

    bool true, if successful

See also:

curses.window:resize (height, width)
Change the size of a window.

Parameters:

  • height int new number of lines
  • width int new number of columns

Returns:

    bool true, if successful
curses.window:scrl (n)
Scroll the window up n lines.

Parameters:

  • n int

Returns:

    bool true, if successful

See also:

curses.window:scrollok (bf)
Scroll up one line when the cursor writes to the last screen position.

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

curses.window:standend ()
Turn off all attributes for subsequent writes to the window.

Returns:

    bool true, if successful

See also:

curses.window:standout ()
Set A_STANDOUT for subsequent writes to the window.

Returns:

    bool true, if successful

See also:

curses.window:sub (nlines, ncols, begin_y, begin_x)
Create a new subwindow.

Parameters:

  • nlines int number of window lines
  • ncols int number of window columns
  • begin_y int top line of window
  • begin_x int leftmost column of window

Returns:

    window a new absolutely positioned subwindow

See also:

curses.window:subpad (nlines, ncols, begin_y, begin_x)
Return a new subpad window object.

Parameters:

  • nlines int
  • ncols int
  • begin_y int
  • begin_x int

Returns:

    window a new subpad window object

See also:

curses.window:syncdown ()
Mark child windows for refresh.

See also:

curses.window:syncok (bf)
Automatically mark ancestors of a changed window for refresh.

Parameters:

  • bf bool

Returns:

    bool true, if successful
curses.window:syncup ()
Mark ancestors of a window for refresh.

See also:

curses.window:timeout (delay)
For differentiating user input from terminal control sequences.

Parameters:

  • delay int milliseconds, 0 for blocking, -1 for non-blocking

See also:

curses.window:touch ([changed])
Set the changed state of a window since the last refresh.

Parameters:

  • changed (optional)

Returns:

    bool true, if successful

See also:

curses.window:touchline (y, n[, changed])
Mark a range of lines as changed since the last refresh.

Parameters:

  • y int
  • n int
  • changed (optional)

Returns:

    bool true, if successful

See also:

curses.window:vline (ch, n)
Draw a column of characters from the current cursor position.

Parameters:

  • ch int
  • n int

Returns:

    bool true, if successful

See also:

curses.window:wbkgd (ch)
Call wbkgdset and then set the background of every position accordingly.

Parameters:

  • ch int

Returns:

    bool true, if successful

See also:

curses.window:wbkgdset (ch)
Set the background attributes for subsequently written characters.

Parameters:

  • ch int

See also:

curses.window:winch ()
Fetch the attributed character at the current cursor position.

Returns:

    int attributed character read from input buffer

See also:

curses.window:winchnstr (n)
Fetch attributed characters from cursor position up to rightmost window position.

Parameters:

  • n int

Returns:

    curses.chstr characters from cursor to end of line

See also:

curses.window:winnstr (n)
Fetch a string from cursor position up to rightmost window position.

Parameters:

  • n int

Returns:

    string string read from input buffer

See also:

curses.window:winsch (ch)
Insert an attributed character before the current cursor position.

Parameters:

  • ch int

Returns:

    bool true, if successful

See also:

curses.window:winsdelln (n)
Call deleteln n times.

Parameters:

  • n int

Returns:

    bool true, if successful

See also:

curses.window:winsnstr (str, n)
Like winsstr, but no more than n characters.

Parameters:

Returns:

    bool true, if successful

See also:

curses.window:winsstr (str)
Insert a string of characters before the current cursor position.

Parameters:

Returns:

    bool true, if successful

See also:

curses.window:wsetscrreg (top, bot)
Set a software scrolling region for the window.

Parameters:

  • top int top line of the scrolling region (line 0 is the first line)
  • bot int bottom line of the scrolling region

Returns:

    bool true, if successful

See also:

Metamethods

curses.window:__tostring ()
Unique string representation of a curses.window.

Returns:

    string unique string representation of the window object.
generated by LDoc 1.4.3 Last updated 2016-01-10 17:53:23