-\versionid $Id: config.but,v 1.42 2002/09/26 18:37:33 simon Exp $
+\versionid $Id: config.but,v 1.43 2002/10/20 13:23:30 simon Exp $
\C{config} Configuring PuTTY
in to do so, and how much silent time is required before the
overload feature will deactivate itself.
+Bell overload mode is always deactivated by any keypress in the
+terminal. This means it can respond to large unexpected streams of
+data, but does not interfere with ordinary command-line activities
+that generate beeps (such as filename completion).
+
\H{config-features} The Features panel
PuTTY's terminal emulation is very highly featured, and can do a lot
GLOBAL int app_cursor_keys, app_keypad_keys, vt52_mode;
GLOBAL int repeat_off, cr_lf_return;
-GLOBAL int seen_key_event;
GLOBAL int seen_disp_event;
GLOBAL int alt_pressed;
void logfclose(void);
void term_copyall(void);
void term_reconfig(void);
+void term_seen_key_event(void);
/*
* Exports from logging.c.
ctx = get_ctx();
if (ctx) {
int need_sbar_update = seen_disp_event;
- if ((seen_key_event && (cfg.scroll_on_key)) ||
- (seen_disp_event && (cfg.scroll_on_disp))) {
+ if (seen_disp_event && cfg.scroll_on_disp) {
disptop = 0; /* return to main screen */
- seen_disp_event = seen_key_event = 0;
+ seen_disp_event = 0;
need_sbar_update = TRUE;
}
if (need_sbar_update)
}
/*
+ * Called from front end when a keypress occurs, to trigger
+ * anything magical that needs to happen in that situation.
+ */
+void term_seen_key_event(void)
+{
+ /*
+ * On any keypress, clear the bell overload mechanism
+ * completely, on the grounds that large numbers of
+ * beeps coming from deliberate key action are likely
+ * to be intended (e.g. beeps from filename completion
+ * blocking repeatedly).
+ */
+ beep_overloaded = FALSE;
+ while (beephead) {
+ struct beeptime *tmp = beephead;
+ beephead = tmp->next;
+ sfree(tmp);
+ }
+ beeptail = NULL;
+ nbeeps = 0;
+
+ /*
+ * Reset the scrollback on keypress, if we're doing that.
+ */
+ if (cfg.scroll_on_key) {
+ disptop = 0; /* return to main screen */
+ seen_disp_event = 1;
+ }
+}
+
+/*
* Same as power_on(), but an external function.
*/
void term_pwron(void)
int len;
get_clip(&data, &len);
- if (data) {
+ if (data && len > 0) {
wchar_t *p, *q;
+ term_seen_key_event(); /* pasted data counts */
+
if (paste_buffer)
sfree(paste_buffer);
paste_pos = paste_hold = paste_len = 0;
The bell overload mode is activated by receiving N bells in time T;
after a further time S without any bells, overload mode will turn
itself off again.
+
+Bell overload mode is always deactivated by any keypress in the
+terminal. This means it can respond to large unexpected streams of
+data, but does not interfere with ordinary command-line activities
+that generate beeps (such as filename completion).
.IP "\fBpterm.BellOverloadN\fP"
This option counts the number of bell characters which will activate
bell overload if they are received within a length of time T. The
ldisc_send(output+start, end-start, 1);
show_mouseptr(0);
- seen_key_event = 1;
+ term_seen_key_event();
term_out();
}
* messages. We _have_ to buffer everything
* we're sent.
*/
+ term_seen_key_event();
ldisc_send(buf, len, 1);
show_mouseptr(0);
}
* luni_send() covering the whole of buff. So
* instead we luni_send the characters one by one.
*/
- for (i = 0; i < n; i += 2)
+ term_seen_key_event();
+ for (i = 0; i < n; i += 2) {
luni_send((unsigned short *)(buff+i), 1, 1);
+ }
free(buff);
}
ImmReleaseContext(hwnd, hIMC);
buf[1] = wParam;
buf[0] = wParam >> 8;
+ term_seen_key_event();
lpage_send(kbd_codepage, buf, 2, 1);
} else {
char c = (unsigned char) wParam;
+ term_seen_key_event();
lpage_send(kbd_codepage, &c, 1, 1);
}
return (0);
*/
{
char c = (unsigned char)wParam;
+ term_seen_key_event();
lpage_send(CP_ACP, &c, 1, 1);
}
return 0;
} else if (compose_state == 1 && wParam != VK_CONTROL)
compose_state = 0;
- /*
- * Record that we pressed key so the scroll window can be reset, but
- * be careful to avoid Shift-UP/Down
- */
- if (wParam != VK_SHIFT && wParam != VK_PRIOR && wParam != VK_NEXT &&
- wParam != VK_MENU && wParam != VK_CONTROL) {
- seen_key_event = 1;
- }
-
if (compose_state > 1 && left_alt)
compose_state = 0;
return 0;
}
keybuf = nc;
+ term_seen_key_event();
luni_send(&keybuf, 1, 1);
continue;
}
if (alt_sum) {
if (in_utf || dbcs_screenfont) {
keybuf = alt_sum;
+ term_seen_key_event();
luni_send(&keybuf, 1, 1);
} else {
ch = (char) alt_sum;
* messages. We _have_ to buffer
* everything we're sent.
*/
+ term_seen_key_event();
ldisc_send(&ch, 1, 1);
}
alt_sum = 0;
} else
+ term_seen_key_event();
lpage_send(kbd_codepage, &ch, 1, 1);
} else {
if(capsOn && ch < 0x80) {
WCHAR cbuf[2];
cbuf[0] = 27;
cbuf[1] = xlat_uskbd2cyrllic(ch);
+ term_seen_key_event();
luni_send(cbuf+!left_alt, 1+!!left_alt, 1);
} else {
char cbuf[2];
cbuf[0] = '\033';
cbuf[1] = ch;
+ term_seen_key_event();
lpage_send(kbd_codepage, cbuf+!left_alt, 1+!!left_alt, 1);
}
}