#include "perlxsi.c"
+#undef LINENO
+#define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows)
+#undef ROW
+#define ROW(n) THIS->row_buf [LINENO (n)]
+
/////////////////////////////////////////////////////////////////////////////
static wchar_t *
OUTPUT:
RETVAL
+int
+rxvt_term::nrow ()
+ CODE:
+ RETVAL = THIS->nrow;
+ OUTPUT:
+ RETVAL
+
+int
+rxvt_term::ncol ()
+ CODE:
+ RETVAL = THIS->ncol;
+ OUTPUT:
+ RETVAL
+
+void
+rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0)
+ PPCODE:
+{
+ if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow))
+ croak ("row_number number of out range");
+
+ line_t &l = ROW(row_number);
+
+ if (GIMME_V != G_VOID)
+ {
+ wchar_t *wstr = new wchar_t [THIS->ncol];
+
+ for (int col = 0; col <THIS->ncol; col++)
+ wstr [col] = l.t [col];
+
+ char *str = rxvt_wcstoutf8 (wstr, THIS->ncol);
+ free (wstr);
+
+ SV *sv = newSVpv (str, 0);
+ SvUTF8_on (sv);
+ XPUSHs (sv_2mortal (sv));
+ free (str);
+ }
+
+ if (new_text)
+ {
+ STRLEN slen;
+ char *str = SvPVutf8 (new_text, slen);
+ wchar_t *wstr = rxvt_utf8towcs (str, slen);
+
+ int len = wcslen (wstr);
+
+ if (start_col + len > THIS->ncol)
+ {
+ free (wstr);
+ croak ("new_text extends beyond right margin");
+ }
+
+ for (int col = start_col; col < start_col + len; col++)
+ {
+ l.t [col] = wstr [col];
+ l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col]));
+ }
+ }
+}
+
+void
+rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0)
+ PPCODE:
+{
+ if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow))
+ croak ("row_number number of out range");
+
+ line_t &l = ROW(row_number);
+
+ if (GIMME_V != G_VOID)
+ {
+ AV *av = newAV ();
+
+ av_extend (av, THIS->ncol - 1);
+ for (int col = 0; col < THIS->ncol; col++)
+ av_store (av, col, newSViv (l.r [col]));
+
+ XPUSHs (sv_2mortal (newRV_noinc ((SV *)av)));
+ }
+
+ if (new_rend)
+ {
+ if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV)
+ croak ("new_rend must be arrayref");
+
+ AV *av = (AV *)SvRV (new_rend);
+ int len = av_len (av) + 1;
+
+ if (start_col + len > THIS->ncol)
+ croak ("new_rend array extends beyond right margin");
+
+ for (int col = start_col; col < start_col + len; col++)
+ {
+ rend_t r = SvIV (*av_fetch (av, col, 1)) & ~RS_fontMask;
+
+ l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col]));
+ }
+ }
+}
+
+int
+rxvt_term::ROW_l (int row_number, int new_length = -2)
+ CODE:
+{
+ if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow))
+ croak ("row_number number of out range");
+
+ line_t &l = ROW(row_number);
+ RETVAL = l.l;
+
+ if (new_length >= -1)
+ l.l = new_length;
+}
+ OUTPUT:
+ RETVAL
+
+SV *
+rxvt_term::special_encode (SV *str)
+ CODE:
+ abort ();//TODO
+
+SV *
+rxvt_term::special_decode (SV *str)
+ CODE:
+ abort ();//TODO
+
void
rxvt_term::_resource (char *name, int index, SV *newval = 0)
PPCODE:
pass characters instead of octets, you should convert your strings first
to the locale-specific encoding using C<< $term->locale_encode >>.
+=item $nrow = $term->nrow
+
+=item $ncol = $term->ncol
+
+Return the number of rows/columns of the terminal window (i.e. as
+specified by C<-geometry>, excluding any scrollback).
+
=item $nsaved = $term->nsaved
Returns the number of lines in the scrollback buffer.
C<0>, which displays the normal terminal contents. Larger values scroll
this many lines into the scrollback buffer.
-=item $text = $term->ROW_t ($row_number[, $new_text])
+=item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]])
Returns the text of the entire row with number C<$row_number>. Row C<0>
is the topmost terminal line, row C<< $term->$ncol-1 >> is the bottommost
terminal line. The scrollback buffer starts at line C<-1> and extends to
line C<< -$term->nsaved >>.
-If C<$new_text> is specified, it will completely replace the current line.
+If C<$new_text> is specified, it will replace characters in the current
+line, starting at column C<$start_col> (default C<0>), which is useful
+to replace only parts of a line. The font iindex in the rendition will
+automatically be updated.
C<$text> is in a special encoding: tabs and wide characters that use more
than one cell when displayed are padded with urxvt::NOCHAR characters
The methods C<< $term->special_encode >> and C<< $term->special_decode >>
can be used to convert normal strings into this encoding and vice versa.
-=item $rend = $term->ROW_r ($row_number[, $new_rend])
+=item $rend = $term->ROW_r ($row_number[, $new_rend[, $start_col]])
+
+Like C<< $term->ROW_t >>, but returns an arrayref with rendition
+bitsets. Rendition bitsets contain information about colour, font, font
+styles and similar information. See also C<< $term->ROW_t >>.
+
+When setting rendition, the font mask will be ignored.
-Like C<< $term->ROW_t >>
+See the section on RENDITION, below.
+
+=item $length = $term->ROW_l ($row_number[, $new_length])
+
+Returns the number of screen cells that are in use ("the line length"). If
+it is C<-1>, then the line is part of a multiple-row logical "line", which
+means all characters are in use and it is continued on the next row.
=item $text = $term->special_encode $string
=back
+=head2 RENDITION
+
+Rendition bitsets contain information about colour, font, font styles and
+similar information for each screen cell.
+
+The following "macros" deal with changes in rendition sets. You should
+never just create a bitset, you should always modify an existing one,
+as they contain important information required for correct operation of
+rxvt-unicode.
+
+=over 4
+
+=item $rend = urxvt::DEFAULT_RSTYLE
+
+Returns the default rendition, as used when the terminal is starting up or
+being reset. Useful as a base
+
+=back
+
+=cut
+
=head2 The C<urxvt::timer> Class
This class implements timer watchers/events. Time is represented as a