mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-26 09:42:25 +00:00
Right, I think we now hove scrolling optimisations. They should probably be
conditional on something, but I can't be bothered right now. [originally from svn r67]
This commit is contained in:
parent
0ce1d562c6
commit
2145f64798
22
macterm.c
22
macterm.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macterm.c,v 1.1.2.11 1999/03/02 14:52:35 ben Exp $ */
|
/* $Id: macterm.c,v 1.1.2.12 1999/03/02 21:51:55 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -494,3 +494,23 @@ void optimised_move(int to, int from, int lines) {
|
|||||||
InvalRgn(update); /* XXX: necessary? probably harmless anyway */
|
InvalRgn(update); /* XXX: necessary? probably harmless anyway */
|
||||||
DisposeRgn(update);
|
DisposeRgn(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Scroll the screen. (`lines' is +ve for scrolling forward, -ve
|
||||||
|
* for backward.)
|
||||||
|
*/
|
||||||
|
void do_scroll(int topline, int botline, int lines) {
|
||||||
|
struct mac_session *s = onlysession;
|
||||||
|
Rect r;
|
||||||
|
RgnHandle update;
|
||||||
|
|
||||||
|
SetPort(s->window);
|
||||||
|
update = NewRgn();
|
||||||
|
SetRect(&r, 0, topline * font_height,
|
||||||
|
cols * font_width, (botline + 1) * font_height);
|
||||||
|
ScrollRect(&r, 0, - lines * font_height, update);
|
||||||
|
/* XXX: move update region? */
|
||||||
|
InvalRgn(update);
|
||||||
|
DisposeRgn(update);
|
||||||
|
}
|
||||||
|
1
putty.h
1
putty.h
@ -196,6 +196,7 @@ void palette_reset (void);
|
|||||||
void write_clip (void *, int);
|
void write_clip (void *, int);
|
||||||
void get_clip (void **, int *);
|
void get_clip (void **, int *);
|
||||||
void optimised_move (int, int, int);
|
void optimised_move (int, int, int);
|
||||||
|
void do_scroll(int, int, int);
|
||||||
void fatalbox (const char *, ...);
|
void fatalbox (const char *, ...);
|
||||||
void beep (void);
|
void beep (void);
|
||||||
#define OPTIMISE_IS_SCROLL 1
|
#define OPTIMISE_IS_SCROLL 1
|
||||||
|
27
terminal.c
27
terminal.c
@ -97,6 +97,7 @@ static void erase_lots (int, int, int);
|
|||||||
static void swap_screen (int);
|
static void swap_screen (int);
|
||||||
static void update_sbar (void);
|
static void update_sbar (void);
|
||||||
static void deselect (void);
|
static void deselect (void);
|
||||||
|
static void scroll_display(int, int, int);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up power-on settings for the terminal.
|
* Set up power-on settings for the terminal.
|
||||||
@ -400,10 +401,30 @@ static void scroll (int topline, int botline, int lines, int sb) {
|
|||||||
selend = scroll_top + size + scroll_size;
|
selend = scroll_top + size + scroll_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
scroll_display(topline, botline, lines);
|
||||||
scroll_heuristic += lines;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void scroll_display(int topline, int botline, int lines) {
|
||||||
|
unsigned long *start, *end;
|
||||||
|
int distance, size, i;
|
||||||
|
|
||||||
|
start = disptext + topline * (cols + 1);
|
||||||
|
end = disptext + (botline + 1) * (cols + 1);
|
||||||
|
distance = (lines > 0 ? lines : -lines) * (cols + 1);
|
||||||
|
size = end - start - distance;
|
||||||
|
if (lines > 0) {
|
||||||
|
memmove(start, start + distance, size * TSIZE);
|
||||||
|
for (i = 0; i < distance; i++)
|
||||||
|
(start + size)[i] |= ATTR_INVALID;
|
||||||
|
} else {
|
||||||
|
memmove(start + distance, start, size * TSIZE);
|
||||||
|
for (i = 0; i < distance; i++)
|
||||||
|
start[i] |= ATTR_INVALID;
|
||||||
|
}
|
||||||
|
do_scroll(topline, botline, lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move the cursor to a given position, clipping at boundaries. We
|
* Move the cursor to a given position, clipping at boundaries. We
|
||||||
* may or may not want to clip at the scroll margin: marg_clip is 0
|
* may or may not want to clip at the scroll margin: marg_clip is 0
|
||||||
@ -1282,6 +1303,8 @@ void term_scroll (int rel, int where) {
|
|||||||
if (disptop > scrtop)
|
if (disptop > scrtop)
|
||||||
disptop = scrtop;
|
disptop = scrtop;
|
||||||
update_sbar();
|
update_sbar();
|
||||||
|
if (rel == 0 && where < rows && where > -rows)
|
||||||
|
scroll_display(0, rows - 1, where);
|
||||||
term_update();
|
term_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user