… | |
… | |
710 | w.start (w.at + TEXT_BLINK_INTERVAL); |
710 | w.start (w.at + TEXT_BLINK_INTERVAL); |
711 | } |
711 | } |
712 | } |
712 | } |
713 | #endif |
713 | #endif |
714 | |
714 | |
|
|
715 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
716 | void |
|
|
717 | rxvt_term::cont_scroll_cb (time_watcher &w) |
|
|
718 | { |
|
|
719 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
|
|
720 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
|
|
721 | { |
|
|
722 | refresh_type |= SMOOTH_REFRESH; |
|
|
723 | want_refresh = 1; |
|
|
724 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
|
|
725 | } |
|
|
726 | } |
|
|
727 | #endif |
|
|
728 | |
|
|
729 | #ifdef SELECTION_SCROLLING |
|
|
730 | void |
|
|
731 | rxvt_term::sel_scroll_cb (time_watcher &w) |
|
|
732 | { |
|
|
733 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
|
|
734 | { |
|
|
735 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
|
|
736 | refresh_type |= SMOOTH_REFRESH; |
|
|
737 | want_refresh = 1; |
|
|
738 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
|
|
739 | } |
|
|
740 | } |
|
|
741 | #endif |
|
|
742 | |
|
|
743 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
|
|
744 | void |
|
|
745 | rxvt_term::slip_wheel_cb (time_watcher &w) |
|
|
746 | { |
|
|
747 | if (mouse_slip_wheel_speed == 0 |
|
|
748 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
|
|
749 | : scr_page (UP, mouse_slip_wheel_speed)) |
|
|
750 | { |
|
|
751 | refresh_type |= SMOOTH_REFRESH; |
|
|
752 | want_refresh = 1; |
|
|
753 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
|
|
754 | } |
|
|
755 | } |
|
|
756 | #endif |
|
|
757 | |
715 | bool |
758 | bool |
716 | rxvt_term::pty_fill () |
759 | rxvt_term::pty_fill () |
717 | { |
760 | { |
718 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
761 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
719 | |
762 | |
… | |
… | |
971 | break; |
1014 | break; |
972 | |
1015 | |
973 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1016 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
974 | case KeyRelease: |
1017 | case KeyRelease: |
975 | { |
1018 | { |
976 | if (! (ev.xkey.state & ControlMask)) |
1019 | if (!(ev.xkey.state & ControlMask)) |
977 | mouse_slip_wheel_speed = 0; |
1020 | slip_wheel_ev.stop (); |
978 | else |
1021 | else |
979 | { |
1022 | { |
980 | KeySym ks; |
1023 | KeySym ks; |
981 | |
1024 | |
982 | ks = XKeycodeToKeysym (display->display, ev.xkey.keycode, 0); |
1025 | ks = XKeycodeToKeysym (display->display, ev.xkey.keycode, 0); |
983 | if (ks == XK_Control_L || ks == XK_Control_R) |
1026 | if (ks == XK_Control_L || ks == XK_Control_R) |
984 | mouse_slip_wheel_speed = 0; |
1027 | mouse_slip_wheel_speed = 0; |
985 | } |
1028 | } |
… | |
… | |
1169 | { |
1212 | { |
1170 | #ifdef NO_SLOW_LINK_SUPPORT |
1213 | #ifdef NO_SLOW_LINK_SUPPORT |
1171 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1214 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1172 | ev.xexpose.width, ev.xexpose.height, False); |
1215 | ev.xexpose.width, ev.xexpose.height, False); |
1173 | #else |
1216 | #else |
1174 | // don't understand this, so commented it out |
1217 | // I don't understand this, so I changed it :) |
1175 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1218 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1176 | ev.xexpose.width, ev.xexpose.height, False); |
1219 | ev.xexpose.width, ev.xexpose.height, False); |
1177 | //scr_expose (ev.xexpose.x, 0, |
1220 | //scr_expose (ev.xexpose.x, 0, |
1178 | // ev.xexpose.width, TermWin.height, False); |
1221 | // ev.xexpose.width, TermWin.height, False); |
1179 | #endif |
1222 | #endif |
… | |
… | |
1181 | } |
1224 | } |
1182 | else |
1225 | else |
1183 | { |
1226 | { |
1184 | XEvent unused_event; |
1227 | XEvent unused_event; |
1185 | |
1228 | |
1186 | while (XCheckTypedWindowEvent (display->display, ev.xany.window, |
1229 | while (XCheckTypedWindowEvent (display->display, ev.xany.window, Expose, &unused_event)) |
1187 | Expose, |
1230 | ; |
1188 | &unused_event)) ; |
|
|
1189 | while (XCheckTypedWindowEvent (display->display, ev.xany.window, |
1231 | while (XCheckTypedWindowEvent (display->display, ev.xany.window, GraphicsExpose, &unused_event)) |
1190 | GraphicsExpose, |
1232 | ; |
1191 | &unused_event)) ; |
1233 | |
1192 | if (isScrollbarWindow (ev.xany.window)) |
1234 | if (isScrollbarWindow (ev.xany.window)) |
1193 | { |
1235 | { |
1194 | scrollBar.setIdle (); |
1236 | scrollBar.setIdle (); |
1195 | scrollbar_show (0); |
1237 | scrollbar_show (0); |
1196 | } |
1238 | } |
… | |
… | |
1239 | if (ev.xbutton.y < TermWin.int_bwidth |
1281 | if (ev.xbutton.y < TermWin.int_bwidth |
1240 | || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) |
1282 | || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) |
1241 | { |
1283 | { |
1242 | int dist; |
1284 | int dist; |
1243 | |
1285 | |
1244 | pending_scroll_selection=1; |
|
|
1245 | |
|
|
1246 | /* don't clobber the current delay if we are |
1286 | /* don't clobber the current delay if we are |
1247 | * already in the middle of scrolling. |
1287 | * already in the middle of scrolling. |
1248 | */ |
1288 | */ |
1249 | if (scroll_selection_delay<=0) |
1289 | if (!sel_scroll_ev.active) |
1250 | scroll_selection_delay=SCROLLBAR_CONTINUOUS_DELAY; |
1290 | sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1251 | |
1291 | |
1252 | /* save the event params so we can highlight |
1292 | /* save the event params so we can highlight |
1253 | * the selection in the pending-scroll loop |
1293 | * the selection in the pending-scroll loop |
1254 | */ |
1294 | */ |
1255 | selection_save_x=ev.xbutton.x; |
1295 | selection_save_x=ev.xbutton.x; |
… | |
… | |
1277 | else |
1317 | else |
1278 | { |
1318 | { |
1279 | /* we are within the text window, so we |
1319 | /* we are within the text window, so we |
1280 | * shouldn't be scrolling |
1320 | * shouldn't be scrolling |
1281 | */ |
1321 | */ |
1282 | pending_scroll_selection = 0; |
1322 | if (sel_scroll_ev.active) |
|
|
1323 | sel_scroll_ev.stop(); |
1283 | } |
1324 | } |
1284 | #endif |
1325 | #endif |
1285 | #ifdef MOUSE_THRESHOLD |
1326 | #ifdef MOUSE_THRESHOLD |
1286 | |
1327 | |
1287 | } |
1328 | } |
… | |
… | |
1504 | upordown = 1; /* down */ |
1545 | upordown = 1; /* down */ |
1505 | } |
1546 | } |
1506 | if (upordown) |
1547 | if (upordown) |
1507 | { |
1548 | { |
1508 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1549 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1509 | scroll_arrow_delay = SCROLLBAR_INITIAL_DELAY; |
1550 | cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1510 | #endif |
1551 | #endif |
1511 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
1552 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
1512 | { |
1553 | { |
1513 | if (upordown < 0) |
1554 | if (upordown < 0) |
1514 | scrollBar.setUp (); |
1555 | scrollBar.setUp (); |
… | |
… | |
1601 | refresh_type &= ~SMOOTH_REFRESH; |
1642 | refresh_type &= ~SMOOTH_REFRESH; |
1602 | #endif |
1643 | #endif |
1603 | |
1644 | |
1604 | } |
1645 | } |
1605 | #ifdef SELECTION_SCROLLING |
1646 | #ifdef SELECTION_SCROLLING |
1606 | pending_scroll_selection=0; |
1647 | if (sel_scroll_ev.active) |
|
|
1648 | sel_scroll_ev.stop(); |
1607 | #endif |
1649 | #endif |
1608 | if (ev.window == TermWin.vt) |
1650 | if (ev.window == TermWin.vt) |
1609 | { |
1651 | { |
1610 | if (reportmode) |
1652 | if (reportmode) |
1611 | { |
1653 | { |
… | |
… | |
1653 | case Button5: |
1695 | case Button5: |
1654 | { |
1696 | { |
1655 | int i; |
1697 | int i; |
1656 | page_dirn v; |
1698 | page_dirn v; |
1657 | |
1699 | |
1658 | v = (ev.button == Button4) ? UP : DN; |
1700 | v = ev.button == Button4 ? UP : DN; |
|
|
1701 | |
1659 | if (ev.state & ShiftMask) |
1702 | if (ev.state & ShiftMask) |
1660 | i = 1; |
1703 | i = 1; |
1661 | else if ((Options & Opt_mouseWheelScrollPage)) |
1704 | else if (Options & Opt_mouseWheelScrollPage) |
1662 | i = TermWin.nrow - 1; |
1705 | i = TermWin.nrow - 1; |
1663 | else |
1706 | else |
1664 | i = 5; |
1707 | i = 5; |
|
|
1708 | |
1665 | # ifdef MOUSE_SLIP_WHEELING |
1709 | # ifdef MOUSE_SLIP_WHEELING |
1666 | if (ev.state & ControlMask) |
1710 | if (ev.state & ControlMask) |
1667 | { |
1711 | { |
1668 | mouse_slip_wheel_speed += (v ? -1 : 1); |
1712 | mouse_slip_wheel_speed += v ? -1 : 1; |
1669 | mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; |
1713 | slip_wheel_ev.start (NOW + SCROLLBAR_CONTINUOUS_DELAY); |
1670 | } |
1714 | } |
1671 | # endif |
1715 | # endif |
1672 | # ifdef JUMP_MOUSE_WHEEL |
1716 | # ifdef JUMP_MOUSE_WHEEL |
1673 | scr_page (v, i); |
1717 | scr_page (v, i); |
1674 | scr_refresh (SMOOTH_REFRESH); |
1718 | scr_refresh (SMOOTH_REFRESH); |
… | |
… | |
2274 | } |
2318 | } |
2275 | |
2319 | |
2276 | return flag; |
2320 | return flag; |
2277 | } |
2321 | } |
2278 | |
2322 | |
|
|
2323 | // read the next octet |
|
|
2324 | unicode_t |
|
|
2325 | rxvt_term::next_octet () |
|
|
2326 | { |
|
|
2327 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2328 | ? *cmdbuf_ptr++ |
|
|
2329 | : NOCHAR; |
|
|
2330 | } |
|
|
2331 | |
2279 | // read the next character |
2332 | // read the next character |
2280 | unicode_t |
2333 | unicode_t |
2281 | rxvt_term::next_char () |
2334 | rxvt_term::next_char () |
2282 | { |
2335 | { |
2283 | while (cmdbuf_ptr < cmdbuf_endp) |
2336 | while (cmdbuf_ptr < cmdbuf_endp) |
… | |
… | |
2314 | */ |
2367 | */ |
2315 | unicode_t |
2368 | unicode_t |
2316 | rxvt_term::cmd_getc () |
2369 | rxvt_term::cmd_getc () |
2317 | { |
2370 | { |
2318 | unicode_t c = next_char (); |
2371 | unicode_t c = next_char (); |
|
|
2372 | |
|
|
2373 | if (c == NOCHAR) |
|
|
2374 | throw out_of_input; |
|
|
2375 | |
|
|
2376 | return c; |
|
|
2377 | } |
|
|
2378 | |
|
|
2379 | unicode_t |
|
|
2380 | rxvt_term::cmd_get8 () |
|
|
2381 | { |
|
|
2382 | unicode_t c = next_octet (); |
2319 | |
2383 | |
2320 | if (c == NOCHAR) |
2384 | if (c == NOCHAR) |
2321 | throw out_of_input; |
2385 | throw out_of_input; |
2322 | |
2386 | |
2323 | return c; |
2387 | return c; |
… | |
… | |
2453 | break; |
2517 | break; |
2454 | case C0_SI: /* shift in - acs */ |
2518 | case C0_SI: /* shift in - acs */ |
2455 | scr_charset_choose (0); |
2519 | scr_charset_choose (0); |
2456 | break; |
2520 | break; |
2457 | |
2521 | |
|
|
2522 | #ifdef EIGHT_BIT_CONTROLS |
2458 | // 8-bit controls |
2523 | // 8-bit controls |
2459 | case 0x90: /* DCS */ |
2524 | case 0x90: /* DCS */ |
2460 | process_dcs_seq (); |
2525 | process_dcs_seq (); |
2461 | break; |
2526 | break; |
2462 | case 0x9b: /* CSI */ |
2527 | case 0x9b: /* CSI */ |
2463 | process_csi_seq (); |
2528 | process_csi_seq (); |
2464 | break; |
2529 | break; |
2465 | case 0x9d: /* CSI */ |
2530 | case 0x9d: /* CSI */ |
2466 | process_osc_seq (); |
2531 | process_osc_seq (); |
2467 | break; |
2532 | break; |
|
|
2533 | #endif |
2468 | } |
2534 | } |
2469 | } |
2535 | } |
2470 | /*}}} */ |
2536 | /*}}} */ |
2471 | |
2537 | |
2472 | |
2538 | |
… | |
… | |
2661 | |
2727 | |
2662 | /*{{{ process CONTROL SEQUENCE INTRODUCER (CSI) sequences `ESC[' */ |
2728 | /*{{{ process CONTROL SEQUENCE INTRODUCER (CSI) sequences `ESC[' */ |
2663 | /* *INDENT-OFF* */ |
2729 | /* *INDENT-OFF* */ |
2664 | enum { |
2730 | enum { |
2665 | CSI_ICH = 0x40, |
2731 | CSI_ICH = 0x40, |
2666 | CSI_CUU, CSI_CUD, CSI_CUF, CSI_CUB, CSI_CNL, CSI_CPL, CSI_CHA, |
2732 | CSI_CUU, CSI_CUD, CSI_CUF, CSI_CUB, CSI_CNL, CSI_CPL, CSI_CHA, |
2667 | CSI_CUP, CSI_CHT, CSI_ED , CSI_EL , CSI_IL , CSI_DL , CSI_EF , CSI_EA , |
2733 | CSI_CUP, CSI_CHT, CSI_ED , CSI_EL , CSI_IL , CSI_DL , CSI_EF , CSI_EA , |
2668 | CSI_DCH, CSI_SEE, CSI_CPR, CSI_SU , CSI_SD , CSI_NP , CSI_PP , CSI_CTC, |
2734 | CSI_DCH, CSI_SEE, CSI_CPR, CSI_SU , CSI_SD , CSI_NP , CSI_PP , CSI_CTC, |
2669 | CSI_ECH, CSI_CVT, CSI_CBT, CSI_SRS, CSI_PTX, CSI_SDS, CSI_SIMD, CSI_5F, |
2735 | CSI_ECH, CSI_CVT, CSI_CBT, CSI_SRS, CSI_PTX, CSI_SDS, CSI_SIMD, CSI_5F, |
2670 | CSI_HPA, CSI_HPR, CSI_REP, CSI_DA , CSI_VPA, CSI_VPR, CSI_HVP, CSI_TBC, |
2736 | CSI_HPA, CSI_HPR, CSI_REP, CSI_DA , CSI_VPA, CSI_VPR, CSI_HVP, CSI_TBC, |
2671 | CSI_SM , CSI_MC , CSI_HPB, CSI_VPB, CSI_RM , CSI_SGR, CSI_DSR, CSI_DAQ, |
2737 | CSI_SM , CSI_MC , CSI_HPB, CSI_VPB, CSI_RM , CSI_SGR, CSI_DSR, CSI_DAQ, |
… | |
… | |
3090 | * ends_how is terminator used. returned input must be free()'d |
3156 | * ends_how is terminator used. returned input must be free()'d |
3091 | */ |
3157 | */ |
3092 | unsigned char * |
3158 | unsigned char * |
3093 | rxvt_term::get_to_st (unicode_t &ends_how) |
3159 | rxvt_term::get_to_st (unicode_t &ends_how) |
3094 | { |
3160 | { |
3095 | int seen_esc = 0; /* seen escape? */ |
3161 | unicode_t prev = 0, ch; |
3096 | unsigned int n = 0; |
3162 | unsigned int n = 0; |
3097 | unsigned char *s; |
3163 | unsigned char *s; |
3098 | unicode_t ch; |
|
|
3099 | unsigned char string[STRING_MAX]; |
3164 | unsigned char string[STRING_MAX]; |
3100 | |
3165 | |
3101 | while ((ch = cmd_getc ())) |
3166 | while ((ch = cmd_getc ()) != NOCHAR) |
3102 | { |
3167 | { |
3103 | if (ch == C0_BEL || ch == CHAR_ST) |
3168 | if (prev == C0_ESC) |
3104 | break; |
3169 | { |
3105 | |
|
|
3106 | if (seen_esc) |
|
|
3107 | if (ch == 0x5c) /* 7bit ST */ |
3170 | if (ch == 0x5c) /* 7bit ST */ |
3108 | break; |
3171 | break; |
3109 | else |
3172 | else |
3110 | return NULL; |
3173 | return NULL; |
3111 | |
|
|
3112 | if (ch == C0_ESC) |
|
|
3113 | { |
3174 | } |
3114 | seen_esc = 1; |
3175 | else if (ch == C0_BEL || ch == CHAR_ST) |
3115 | continue; |
3176 | break; |
3116 | } |
|
|
3117 | else if (ch == C0_HT) |
3177 | else if (ch < 0x20) |
3118 | ch = ' '; /* translate '\t' to space */ |
|
|
3119 | else if (ch < 0x20 && (ch != C0_LF && ch != C0_CR)) |
|
|
3120 | return NULL; /* other control character - exit */ |
3178 | return NULL; /* other control character - exit */ |
3121 | |
3179 | |
3122 | if (n >= sizeof (string) - 1) |
3180 | if (n >= sizeof (string) - 1) |
3123 | // stop at some sane length |
3181 | // stop at some sane length |
3124 | return NULL; |
3182 | return NULL; |
3125 | |
3183 | |
|
|
3184 | if (ch == C0_SYN) |
|
|
3185 | { |
|
|
3186 | string[n++] = cmd_get8 (); |
|
|
3187 | prev = 0; |
|
|
3188 | } |
|
|
3189 | else |
3126 | string[n++] = ch; |
3190 | string[n++] = prev = ch; |
3127 | seen_esc = 0; |
|
|
3128 | } |
3191 | } |
3129 | |
3192 | |
3130 | string[n++] = '\0'; |
3193 | string[n++] = '\0'; |
3131 | |
3194 | |
3132 | if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) |
3195 | if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) |