--- rxvt-unicode/src/command.C 2014/04/26 15:05:17 1.545 +++ rxvt-unicode/src/command.C 2014/11/24 21:46:04 1.560 @@ -32,7 +32,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -212,7 +212,7 @@ if (y >= 0) { - y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; + y = (y >= nrow - len - 5 && x < width + 2) ? 0 : -1; x = 0; } @@ -317,13 +317,8 @@ XK_KP_8, // XK_KP_Up XK_KP_6, // XK_KP_Right XK_KP_2, // XK_KP_Down -# ifndef UNSHIFTED_SCROLLKEYS XK_KP_9, // XK_KP_Prior XK_KP_3, // XK_KP_Next -# else - XK_Prior, - XK_Next, -# endif XK_KP_1, // XK_KP_End XK_KP_5, // XK_KP_Begin }; @@ -378,7 +373,6 @@ case XK_Select: param = 4; break; -#ifndef UNSHIFTED_SCROLLKEYS case XK_Prior: param = 5; break; @@ -391,7 +385,6 @@ case XK_End: param = 8; break; -#endif case XK_Help: param = 28; break; @@ -415,9 +408,8 @@ rxvt_term::key_press (XKeyEvent &ev) { int ctrl, meta, shft, len; - KeySym keysym; - int valid_keysym; - char rkbuf[KBUFSZ]; + KeySym keysym = NoSymbol; + char rkbuf[KBUFSZ + 1]; char *kbuf = rkbuf + 1; #if ISO_14755 @@ -485,19 +477,24 @@ else len = 0; } - - valid_keysym = status_return == XLookupKeySym - || status_return == XLookupBoth; } else #endif { len = XLookupString (&ev, kbuf, KBUFSZ, &keysym, &compose); - valid_keysym = keysym != NoSymbol; } - if (valid_keysym) + if (keysym != NoSymbol) { + KeySym orig_keysym = keysym; + + /* Shift + F1 - F10 generates F11 - F20 */ + if (shft && keysym >= XK_F1 && keysym <= XK_F10) + { + keysym += (XK_F11 - XK_F1); + shft = 0; /* turn off Shift */ + } + if (keysym >= 0xFF00 && keysym <= 0xFFFF) { bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; @@ -681,12 +678,12 @@ for (ch = kbuf; ch < kbuf + len; ch++) *ch |= 0x80; - - meta = 0; } #endif /* nil */ ; } + + keysym = orig_keysym; } /* escape prefix */ @@ -700,7 +697,10 @@ len++; } - if (valid_keysym) + if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) + return; + + if (keysym != NoSymbol) { #ifdef KEYSYM_RESOURCE if (keyboard->dispatch (this, keysym, ev.state, kbuf, len)) @@ -769,13 +769,7 @@ if (shft) { - /* Shift + F1 - F10 generates F11 - F20 */ - if (keysym >= XK_F1 && keysym <= XK_F10) - { - keysym += (XK_F11 - XK_F1); - shft = 0; /* turn off Shift */ - } - else if (!ctrl && !meta && (priv_modes & PrivMode_ShiftKeys)) + if (!ctrl && !meta && (priv_modes & PrivMode_ShiftKeys)) { switch (keysym) { @@ -873,20 +867,10 @@ #endif } - if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) - return; - if (len <= 0) return; /* not mapped */ - if (option (Opt_scrollTtyKeypress)) - if (view_start) - { - view_start = 0; - want_refresh = 1; - } - - tt_write (kbuf, (unsigned int)len); + tt_write_user_input (kbuf, (unsigned int)len); } void ecb_cold @@ -1929,7 +1913,7 @@ } #endif - clickintime = ev.time - MEvent.time < MULTICLICK_TIME; + clickintime = ev.time - MEvent.time < multiClickTime; if (reportmode) { @@ -2189,7 +2173,7 @@ if (MEvent.button != AnyButton && (ev.button != MEvent.button || (ev.time - MEvent.time - > MULTICLICK_TIME / 2))) + > multiClickTime / 2))) { MEvent.clicks = 0; MEvent.button = AnyButton; @@ -2589,13 +2573,13 @@ #ifdef EIGHT_BIT_CONTROLS // 8-bit controls - case 0x90: /* DCS */ + case 0x90: /* DCS */ process_dcs_seq (); break; - case 0x9b: /* CSI */ + case 0x9b: /* CSI */ process_csi_seq (); break; - case 0x9d: /* OSC */ + case 0x9d: /* OSC */ process_osc_seq (); break; #endif @@ -3110,7 +3094,7 @@ priv_modes |= PrivMode_LFNL; break; - case CSI_71: // DESCUSR: set cursor style + case CSI_71: // DECSCUSR: set cursor style if (prev_ch == ' ') set_cursor_style (arg[0]); break; @@ -3698,6 +3682,7 @@ { 7, PrivMode_Autowrap }, // DECAWM // 8, auto-repeat keys // DECARM { 9, PrivMode_MouseX10 }, + { 12, PrivMode_BlinkingCursor }, // 18 end FF to printer after print screen // 19 Print screen prints full screen/scroll region { 25, PrivMode_VisibleCursor }, // DECTCEM cnorm/cvvis/civis @@ -3816,6 +3801,12 @@ scr_touch (true); break; #endif +#ifdef CURSOR_BLINK + case 12: + set_option (Opt_cursorBlink, state); + cursor_blink_reset (); + break; +#endif case 25: /* visible/invisible cursor */ scr_cursor_visible (state); break; @@ -4033,13 +4024,17 @@ void rxvt_term::set_cursor_style (int style) { - if (!IN_RANGE_INC (style, 0, 4)) + if (!IN_RANGE_INC (style, 0, 6)) return; - set_option (Opt_cursorUnderline, style >= 3); + if (style == 0) + style = 1; + + cursor_type = (style - 1) / 2; + set_option (Opt_cursorUnderline, cursor_type == 1); #ifdef CURSOR_BLINK - set_option (Opt_cursorBlink, !style || (style & 1)); + set_option (Opt_cursorBlink, style & 1); cursor_blink_reset (); #endif @@ -4047,7 +4042,10 @@ } /*}}} */ -/* ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ +/* Write data to the pty as typed by the user, pasted with the mouse, + * or generated by us in response to a query ESC sequence. + */ /* * Send printf () formatted output to the command. @@ -4065,11 +4063,22 @@ tt_write (buf, strlen (buf)); } -/* ---------------------------------------------------------------------- */ -/* Write data to the pty as typed by the user, pasted with the mouse, - * or generated by us in response to a query ESC sequence. - */ -static const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT +/* Write data to the pty as typed by the user. */ +void +rxvt_term::tt_write_user_input (const char *data, unsigned int len) +{ + if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) + return; + + if (option (Opt_scrollTtyKeypress)) + if (view_start) + { + view_start = 0; + want_refresh = 1; + } + + tt_write_ (data, len); +} void rxvt_term::tt_write (const char *data, unsigned int len) @@ -4077,6 +4086,14 @@ if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) return; + tt_write_ (data, len); +} + +static const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT + +void +rxvt_term::tt_write_ (const char *data, unsigned int len) +{ if (pty->pty < 0) return;