1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 18:07:59 +00:00

Auto-scrolling now works properly.

[originally from svn r97]
This commit is contained in:
Ben Harris 1999-03-13 18:23:24 +00:00
parent 13d3a23263
commit a5f734f8e4

View File

@ -1,4 +1,4 @@
/* $Id: macterm.c,v 1.1.2.18 1999/03/11 23:23:45 ben Exp $ */
/* $Id: macterm.c,v 1.1.2.19 1999/03/13 18:23:24 ben Exp $ */
/*
* Copyright (c) 1999 Ben Harris
* All rights reserved.
@ -57,6 +57,11 @@
#define CURSOR_FG 22
#define CURSOR_FG_BOLD 23
#define PTOCC(x) ((x) < 0 ? -(-(x - font_width - 1) / font_width) : \
(x) / font_width)
#define PTOCR(y) ((y) < 0 ? -(-(y - font_height - 1) / font_height) : \
(y) / font_height)
struct mac_session {
short fontnum;
int font_ascent;
@ -263,8 +268,8 @@ static void text_click(struct mac_session *s, EventRecord *event) {
localwhere = event->where;
GlobalToLocal(&localwhere);
col = localwhere.h / font_width;
row = localwhere.v / font_height;
col = PTOCC(localwhere.h);
row = PTOCR(localwhere.v);
if (event->when - lastwhen < GetDblTime() &&
row == lastrow && col == lastcol && s == lastsess)
lastact = (lastact == MA_CLICK ? MA_2CLK :
@ -279,14 +284,14 @@ static void text_click(struct mac_session *s, EventRecord *event) {
lastcol = col;
while (StillDown()) {
GetMouse(&localwhere);
col = localwhere.h / font_width;
row = localwhere.v / font_height;
col = PTOCC(localwhere.h);
row = PTOCR(localwhere.v);
term_mouse(event->modifiers & shiftKey ? MB_EXTEND : MB_SELECT,
MA_DRAG, col, row);
if (row > rows - 1)
term_scroll(0, row - (rows - 1));
else if (row <= 0)
term_scroll(0, row - 1);
else if (row < 0)
term_scroll(0, row);
}
term_mouse(event->modifiers & shiftKey ? MB_EXTEND : MB_SELECT, MA_RELEASE,
col, row);
@ -295,6 +300,7 @@ static void text_click(struct mac_session *s, EventRecord *event) {
void write_clip(void *data, int len) {
SysBeep(30);
if (ZeroScrap() != noErr)
return;
PutScrap(len, 'TEXT', data);