/*
* Internal prototypes.
*/
+static unsigned long *resizeline(unsigned long *, int);
+static unsigned long *lineptr(Terminal *, int, int);
static void do_paint(Terminal *, Context, int);
static void erase_lots(Terminal *, int, int, int);
static void swap_screen(Terminal *, int, int, int);
/*
* Resize a line to make it `cols' columns wide.
*/
-unsigned long *resizeline(unsigned long *line, int cols)
+static unsigned long *resizeline(unsigned long *line, int cols)
{
int i, oldlen;
unsigned long lineattrs;
* whether the y coordinate is non-negative or negative
* (respectively).
*/
-unsigned long *lineptr(Terminal *term, int y, int lineno)
+static unsigned long *lineptr(Terminal *term, int y, int lineno)
{
unsigned long *line, *newline;
tree234 *whichtree;
term->nbeeps = 0;
term->lastbeep = FALSE;
term->beep_overloaded = FALSE;
+ term->attr_mask = 0xffffffff;
term->resize_fn = NULL;
term->resize_ctx = NULL;
static void scroll(Terminal *term, int topline, int botline, int lines, int sb)
{
unsigned long *line, *line2;
- int i, seltop;
+ int i, seltop, olddisptop, shift;
if (topline != 0 || term->alt_which != 0)
sb = FALSE;
+ olddisptop = term->disptop;
+ shift = lines;
if (lines < 0) {
while (lines < 0) {
line = delpos234(term->screen, botline);
lines--;
}
}
+#ifdef OPTIMISE_SCROLL
+ shift += term->disptop - olddisptop;
+ if (shift < term->rows && shift > -term->rows && shift != 0)
+ scroll_display(term, topline, botline, shift);
+#endif /* OPTIMISE_SCROLL */
}
#ifdef OPTIMISE_SCROLL
size = end - start - distance;
if (lines > 0) {
memmove(start, start + distance, size * TSIZE);
+ if (term->dispcurs >= start + distance &&
+ term->dispcurs <= start + distance + size)
+ term->dispcurs -= distance;
for (i = 0; i < distance; i++)
(start + size)[i] |= ATTR_INVALID;
} else {
memmove(start + distance, start, size * TSIZE);
+ if (term->dispcurs >= start && term->dispcurs <= start + size)
+ term->dispcurs += distance;
for (i = 0; i < distance; i++)
start[i] |= ATTR_INVALID;
}
term->logctx)
logtraffic(term->logctx, (unsigned char) c, LGTYP_ASCII);
{
- extern int wcwidth(wchar_t ucs);
int width = 0;
if (DIRECT_CHAR(c))
width = 1;
if ((term->disptext[idx] ^ tattr) & ATTR_WIDE)
dirty_line = TRUE;
- break_run = (tattr != attr || j - start >= sizeof(ch));
+ break_run = (((tattr ^ attr) & term->attr_mask) ||
+ j - start >= sizeof(ch));
/* Special hack for VT100 Linedraw glyphs */
if ((attr & CSET_MASK) == 0x2300 && tchar >= 0xBA
int rv;
if (is_dbcs_leadbyte(font_codepage, (BYTE) c)) {
buf[0] = c;
- buf[1] = ldata[top.x + 1];
+ buf[1] = (char) (0xFF & ldata[top.x + 1]);
rv = mb_to_wc(font_codepage, 0, buf, 2, wbuf, 4);
top.x++;
} else {