Class posix.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

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

Metamethods

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


Methods

posix.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:

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

Parameters:

  • chstr int cs
  • n int (optional)

Returns:

    bool true, if successful

See also:

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

Parameters:

Returns:

    bool true, if successful

See also:

posix.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:

posix.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:

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

Parameters:

  • attrs int

Returns:

    bool true, if successful

See also:

posix.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)
posix.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)
posix.curses.window:clear ()
Call erase and then clearok.

Returns:

    bool true, if successful

See also:

posix.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:

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

Returns:

    window a new duplicate of this window

See also:

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

See also:

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

Returns:

    bool true, if successful

See also:

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

Returns:

    bool true, if successful

See also:

posix.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:

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

See also:

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

Returns:

    bool true, if successful

See also:

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

Returns:

    bool true, if successful

See also:

posix.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:

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

Parameters:

  • ch int

Returns:

    bool true, if successful

See also:

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

Returns:

    bool true, if successful

See also:

posix.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:

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

Returns:

    int current window background attribute

See also:

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

Returns:

    bool true, if successful

See also:

posix.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:

posix.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:

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

Parameters:

  • n int (optional)

Returns:

    bool true, if successful

See also:

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

Returns:

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

See also:

posix.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)
posix.curses.window:idcok (bf)
Use hardware character insert and delete on supporting terminals.

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

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

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

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

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

posix.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:

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

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

posix.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:

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

Returns:

    bool true, if successful

See also:

posix.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:

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

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

posix.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:

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

Parameters:

  • y int
  • x int

Returns:

    bool true, if successful

See also:

posix.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:

posix.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:

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

Parameters:

  • ch int

Returns:

    bool true, if successful

See also:

posix.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:

posix.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:

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

Parameters:

  • y int
  • x int

Returns:

    bool true, if successful

See also:

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

Parameters:

  • y int
  • x int

Returns:

    bool true, if successful

See also:

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

Parameters:

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

Returns:

    bool true, if successful

See also:

posix.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:

posix.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:

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

Parameters:

  • y int
  • x int

Returns:

    bool true, if successful

See also:

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

Parameters:

  • y int
  • x int
  • n int

Returns:

    bool true, if successful

See also:

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

Parameters:

  • y int
  • x int
  • n int

Returns:

    bool true, if successful

See also:

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

Parameters:

  • y int
  • x int
  • ch int

Returns:

    bool true, if successful

See also:

posix.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:

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

Parameters:

Returns:

    bool true, if successful

See also:

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

Parameters:

  • on bool

Returns:

    bool true, if successful

See also:

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

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

posix.curses.window:noutrefresh ()
Copy the window backing screen to the virtual screen.

Returns:

    bool true, if successful

See also:

posix.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:

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

Parameters:

  • dst window destination window

Returns:

    bool true, if successful

See also:

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

Parameters:

  • ch int

Returns:

    bool true, if successful

See also:

posix.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:

posix.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:

posix.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:

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

Returns:

    bool true, if successful

See also:

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

Returns:

    bool true, if successful

See also:

posix.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

See also:

posix.curses.window:scrl (n)
Scroll the window up n lines.

Parameters:

  • n int

Returns:

    bool true, if successful

See also:

posix.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:

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

Returns:

    bool true, if successful

See also:

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

Returns:

    bool true, if successful

See also:

posix.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:

posix.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:

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

See also:

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

Parameters:

  • bf bool

Returns:

    bool true, if successful

See also:

posix.curses.window:syncup ()
Mark ancestors of a window for refresh.

See also:

posix.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:

posix.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:

posix.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:

posix.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:

posix.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:

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

Parameters:

  • ch int

See also:

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

Returns:

    bool true, if successful

See also:

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

Parameters:

  • n int

Returns:

    posix.curses.chstr characters from cursor to end of line

See also:

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

Parameters:

  • n int

Returns:

    bool true, if successful

See also:

posix.curses.window:winsch (ch)
Insert a character before the current cursor position.

Parameters:

  • ch int

Returns:

    bool true, if successful

See also:

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

Parameters:

  • n int

Returns:

    bool true, if successful

See also:

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

Parameters:

Returns:

    bool true, if successful

See also:

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

Parameters:

Returns:

    bool true, if successful

See also:

posix.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

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

Returns:

    string unique string representation of the window object.
generated by LDoc 1.4.3 Last updated 2015-01-04 12:06:34