--- rxvt-unicode/src/rxvtlib.h.in 2005/10/25 19:16:50 1.48 +++ rxvt-unicode/src/rxvtlib.h.in 2005/12/20 19:30:59 1.51 @@ -79,6 +79,32 @@ typedef uint16_t text_t; // saves lots of memory #endif typedef uint32_t rend_t; +typedef int16_t tlen_t; + +#define LINE_CONT -1 + +struct line_t { + text_t *t; // terminal the text + rend_t *r; // rendition, uses RS_ flags + tlen_t l; // length of each text line, LINE_CONT == continued on next line + + bool is_longer () + { + return l < 0; + } + + void set_is_longer () + { + l = LINE_CONT; + } + + void clear () + { + t = 0; + r = 0; + l = 0; + } +}; /* * TermWin elements limits @@ -87,11 +113,13 @@ * ncol : 1 <= ncol <= MAX(int16_t) * nrow : 1 <= nrow <= MAX(int16_t) * saveLines : 0 <= saveLines <= MAX(int16_t) - * nscrolled : 0 <= nscrolled <= saveLines - * view_start: 0 <= view_start <= nscrolled + * nlines : nrow + saveLines + * nsaved : 0 <= nsaved <= saveLines + * term_start: 0 <= term_start < saveLines + * view_start: 0 <= view_start < saveLines */ -typedef struct { +struct TermWin_t { int width; /* window width [pixels] */ int height; /* window height [pixels] */ int fwidth; /* font width [pixels] */ @@ -106,7 +134,9 @@ int ext_bwidth; /* external border width */ int lineSpace; /* number of extra pixels between rows */ int saveLines; /* number of lines that fit in scrollback */ - int nscrolled; /* number of line actually scrolled */ + int total_rows; /* total number of rows in this terminal */ + int nsaved; /* number of rows saved to scrollback */ + int term_start; /* term lines start here */ int view_start; /* scrollback view starts here */ Window parent[6]; /* parent identifiers - we're parent[0] */ Window vt; /* vt100 window */ @@ -114,21 +144,21 @@ Pixmap pixmap; rxvt_drawable *drawable; rxvt_fontset *fontset[4]; -} TermWin_t; +}; /* * screen accounting: * screen_t elements * text: Contains all text information including the scrollback buffer. - * Each line is length TermWin.ncol + * Each line is length ncol * tlen: The length of the line or -1 for wrapped lines. * rend: Contains rendition information: font, bold, colour, etc. * * Note: Each line for both text and rend are only allocated on demand, and * text[x] is allocated <=> rend[x] is allocated for all x. - * row: Cursor row position : 0 <= row < TermWin.nrow - * col: Cursor column position : 0 <= col < TermWin.ncol - * tscroll: Scrolling region top row inclusive : 0 <= row < TermWin.nrow - * bscroll: Scrolling region bottom row inclusive : 0 <= row < TermWin.nrow + * row: Cursor row position : 0 <= row < nrow + * col: Cursor column position : 0 <= col < ncol + * tscroll: Scrolling region top row inclusive : 0 <= row < nrow + * bscroll: Scrolling region bottom row inclusive : 0 <= row < nrow * * selection_t elements * clicks: 1, 2 or 3 clicks - 4 indicates a special condition of 1 where @@ -136,19 +166,18 @@ * beg: row/column of beginning of selection : never past mark * mark: row/column of initial click : never past end * end: row/column of one character past end of selection - * * Note: -TermWin.nscrolled <= beg.row <= mark.row <= end.row < TermWin.nrow + * * Note: -nsaved <= beg.row <= mark.row <= end.row < nrow * * Note: col == -1 ==> we're left of screen * * Layout of text/rend information in the screen_t text/rend structures: - * Rows [0] ... [TermWin.saveLines - 1] - * scrollback region : we're only here if TermWin.view_start != 0 - * Rows [TermWin.saveLines] ... [TermWin.saveLines + TermWin.nrow - 1] - * normal `unscrolled' screen region + * Rows [0] ... [saveLines - 1] + * scrollback region : we're only here if view_start != 0 + * Rows [saveLines] ... [saveLines + nrow - 1] + * normal `unsaved' screen region */ typedef struct { - int16_t *tlen; /* length of each text line */ - text_t **text; /* _all_ the text */ - rend_t **rend; /* rendition, uses RS_ flags */ + line_t **line; + row_col_t cur; /* cursor position on the screen */ unsigned int tscroll; /* top of settable scroll region */ unsigned int bscroll; /* bottom of settable scroll region */ @@ -256,8 +285,7 @@ void setDn() { state = 'D'; } } scrollBar_t; -struct rxvt_vars { - TermWin_t TermWin; +struct rxvt_vars : TermWin_t { scrollBar_t scrollBar; menuBar_t menuBar; unsigned long options; @@ -273,10 +301,10 @@ int sb_shadow; /* scrollbar shadow width */ rxvt_ptytty pty; int numlock_state; - text_t **drawn_text; /* text drawn on screen (characters) */ - rend_t **drawn_rend; /* text drawn on screen (rendition) */ - text_t **buf_text; - rend_t **buf_rend; + line_t *save; // all lines, scorllback + terminal, circular + line_t *drawn; // text on screen + line_t *buf; // temporary buffer + line_t *swap_save; // lines for swap buffer char *tabs; /* per location: 1 == tab-stop */ screen_t screen; screen_t swap;