--- rxvt-unicode/src/rxvtlib.h.in 2005/12/18 00:59:42 1.49 +++ rxvt-unicode/src/rxvtlib.h.in 2005/12/31 16:06:48 1.55 @@ -79,7 +79,7 @@ typedef uint16_t text_t; // saves lots of memory #endif typedef uint32_t rend_t; -typedef int16_t tlen_t; +typedef int32_t tlen_t; // was int16_t, but this result sin smaller code and memory use #define LINE_CONT -1 @@ -88,11 +88,16 @@ rend_t *r; // rendition, uses RS_ flags tlen_t l; // length of each text line, LINE_CONT == continued on next line - bool is_cont () + bool is_longer () { return l < 0; } + void set_is_longer () + { + l = LINE_CONT; + } + void clear () { t = 0; @@ -102,15 +107,38 @@ }; /* - * TermWin elements limits - * width : 1 <= width - * height : 1 <= height - * ncol : 1 <= ncol <= MAX(int16_t) - * nrow : 1 <= nrow <= MAX(int16_t) - * saveLines : 0 <= saveLines <= MAX(int16_t) - * nsaved : 0 <= nscrolled <= saveLines - * term_start: 0 <= term_start < saveLines - * view_start: 0 <= view_start < saveLines + * terminal limits: + * + * width : 1 <= width + * height : 1 <= height + * ncol : 1 <= ncol <= MAX(tlen_t) + * nrow : 1 <= nrow <= MAX(int) + * saveLines : 0 <= saveLines <= MAX(int) + * total_rows : nrow + saveLines + * nsaved : 0 <= nsaved <= saveLines + * term_start : 0 <= term_start < saveLines + * view_start : 0 <= view_start < saveLines + * + * | most coordinates are stored relative to term_start, + * ROW_BUF | which is the first line of the terminal screen + * |························= row_buf[0] + * |························= row_buf[1] + * |························= row_buf[2] etc. + * | + * +------------+···········= term_start - nsaved + * | scrollback | + * | scrollback +---------+·= term_start - view_start + * | scrollback | display | + * | scrollback | display | + * +------------+·display·+·= term_start + * | terminal | display | + * | terminal +---------+ + * | terminal | + * | terminal | + * +------------+···········= term_stat + nrow - 1 + * | + * | + * END······················= total_rows */ struct TermWin_t { @@ -118,7 +146,6 @@ int height; /* window height [pixels] */ int fwidth; /* font width [pixels] */ int fheight; /* font height [pixels] */ - int fweight, fslant; int fbase; /* font ascent (baseline) [pixels] */ int ncol; /* window columns [characters] */ int nrow; /* window rows [characters] */ @@ -128,8 +155,8 @@ int ext_bwidth; /* external border width */ int lineSpace; /* number of extra pixels between rows */ int saveLines; /* number of lines that fit in scrollback */ - int nsaved; /* number of line actually scrolled */ - int nscrolled; /*D*///TODO remove + 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] */ @@ -143,12 +170,6 @@ /* * screen accounting: * screen_t elements - * text: Contains all text information including the scrollback buffer. - * 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 < nrow * col: Cursor column position : 0 <= col < ncol * tscroll: Scrolling region top row inclusive : 0 <= row < nrow @@ -160,21 +181,14 @@ * 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: -nscrolled <= beg.row <= mark.row <= end.row < 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] ... [saveLines - 1] - * scrollback region : we're only here if view_start != 0 - * Rows [saveLines] ... [saveLines + nrow - 1] - * normal `unscrolled' screen region */ typedef struct { - 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 */ + row_col_t cur; /* cursor position on the screen */ + int tscroll; /* top of settable scroll region */ + int bscroll; /* bottom of settable scroll region */ unsigned int charset; /* character set number [0..3] */ unsigned int flags; /* see below */ row_col_t s_cur; /* saved cursor position */ @@ -241,9 +255,16 @@ #if ENABLE_FRILLS # define Opt_insecure (1UL<<24) // insecure esc sequences # define Opt_borderLess (1UL<<25) // mem borderless hints +# define Opt_hold (1UL<<26) // hold window open after exit #else # define Opt_insecure 0 # define Opt_borderLess 0 +# define Opt_hold 0 +#endif +#if ENABLE_STYLES +# define Opt_intensityStyles (1UL<<27) // font styles imply intensity +#else +# define Opt_intensityStyles 0 #endif /* place holder used for parsing command-line options */ #define Opt_Reverse (1UL<<30) @@ -251,7 +272,7 @@ #define DEFAULT_OPTIONS (Opt_scrollBar | Opt_scrollTtyOutput \ | Opt_jumpScroll | Opt_secondaryScreen \ - | Opt_pastableTabs) + | Opt_pastableTabs | Opt_intensityStyles) /* ------------------------------------------------------------------------- */ @@ -295,10 +316,10 @@ int sb_shadow; /* scrollbar shadow width */ rxvt_ptytty pty; int numlock_state; - 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 + line_t *row_buf; // all lines, scrollback + terminal, circular + line_t *drawn_buf; // text on screen + line_t *temp_buf; // temporary buffer + line_t *swap_buf; // lines for swap buffer char *tabs; /* per location: 1 == tab-stop */ screen_t screen; screen_t swap;