ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.533 by sf-exg, Fri Feb 1 11:26:40 2013 UTC vs.
Revision 1.542 by root, Thu Apr 24 22:32:59 2014 UTC

25 * - extensive modifications 25 * - extensive modifications
26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> 26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org>
27 * Copyright (c) 2001 Marius Gedminas 27 * Copyright (c) 2001 Marius Gedminas
28 * - Ctrl/Mod4+Tab works like Meta+Tab (options) 28 * - Ctrl/Mod4+Tab works like Meta+Tab (options)
29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> 29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org>
30 * Copyright (c) 2003-2011 Marc Lehmann <schmorp@schmorp.de> 30 * Copyright (c) 2003-2014 Marc Lehmann <schmorp@schmorp.de>
31 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it> 31 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it>
32 * 32 *
33 * This program is free software; you can redistribute it and/or modify 33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU General Public License as published by 34 * it under the terms of the GNU General Public License as published by
35 * the Free Software Foundation; either version 2 of the License, or 35 * the Free Software Foundation; either version 2 of the License, or
510#endif 510#endif
511 max_it (lnsppg, 1); 511 max_it (lnsppg, 1);
512 512
513 if (keysym == XK_Prior) 513 if (keysym == XK_Prior)
514 { 514 {
515 scr_page (UP, lnsppg); 515 scr_page (lnsppg);
516 return; 516 return;
517 } 517 }
518 else if (keysym == XK_Next) 518 else if (keysym == XK_Next)
519 { 519 {
520 scr_page (DN, lnsppg); 520 scr_page (-lnsppg);
521 return; 521 return;
522 } 522 }
523 } 523 }
524#ifdef SCROLL_ON_UPDOWN_KEYS 524#ifdef SCROLL_ON_UPDOWN_KEYS
525 if (IS_SCROLL_MOD) 525 if (IS_SCROLL_MOD)
526 { 526 {
527 if (keysym == XK_Up) 527 if (keysym == XK_Up)
528 { 528 {
529 scr_page (UP, 1); 529 scr_page (1);
530 return; 530 return;
531 } 531 }
532 else if (keysym == XK_Down) 532 else if (keysym == XK_Down)
533 { 533 {
534 scr_page (DN, 1); 534 scr_page (-1);
535 return; 535 return;
536 } 536 }
537 } 537 }
538#endif 538#endif
539#ifdef SCROLL_ON_HOMEEND_KEYS 539#ifdef SCROLL_ON_HOMEEND_KEYS
540 if (IS_SCROLL_MOD) 540 if (IS_SCROLL_MOD)
541 { 541 {
542 if (keysym == XK_Home) 542 if (keysym == XK_Home)
543 { 543 {
544 scr_move_to (0, 1); 544 scr_changeview (top_row);
545 return; 545 return;
546 } 546 }
547 else if (keysym == XK_End) 547 else if (keysym == XK_End)
548 { 548 {
549 scr_move_to (1, 1); 549 scr_changeview (0);
550 return; 550 return;
551 } 551 }
552 } 552 }
553#endif 553#endif
554 } 554 }
1077 1077
1078#ifdef SELECTION_SCROLLING 1078#ifdef SELECTION_SCROLLING
1079void 1079void
1080rxvt_term::sel_scroll_cb (ev::timer &w, int revents) 1080rxvt_term::sel_scroll_cb (ev::timer &w, int revents)
1081{ 1081{
1082 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1082 if (scr_page (scroll_selection_lines))
1083 { 1083 {
1084 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1084 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1085 want_refresh = 1; 1085 want_refresh = 1;
1086 refresh_check (); 1086 refresh_check ();
1087 } 1087 }
1092 1092
1093#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1093#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1094void 1094void
1095rxvt_term::slip_wheel_cb (ev::timer &w, int revents) 1095rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1096{ 1096{
1097 if (scr_changeview (view_start - mouse_slip_wheel_speed)) 1097 if (scr_page (mouse_slip_wheel_speed))
1098 { 1098 {
1099 want_refresh = 1; 1099 want_refresh = 1;
1100 refresh_check (); 1100 refresh_check ();
1101 } 1101 }
1102 1102
1638 1638
1639#ifdef SELECTION_SCROLLING 1639#ifdef SELECTION_SCROLLING
1640 if (ev.xbutton.y < int_bwidth 1640 if (ev.xbutton.y < int_bwidth
1641 || Pixel2Row (ev.xbutton.y) > (nrow-1)) 1641 || Pixel2Row (ev.xbutton.y) > (nrow-1))
1642 { 1642 {
1643 page_dirn scroll_selection_dir;
1643 int dist; 1644 int dist;
1644 1645
1645 /* don't clobber the current delay if we are 1646 /* don't clobber the current delay if we are
1646 * already in the middle of scrolling. 1647 * already in the middle of scrolling.
1647 */ 1648 */
1670 scroll_selection_lines = Pixel2Height (dist) 1671 scroll_selection_lines = Pixel2Height (dist)
1671 / SELECTION_SCROLL_LINE_SPEEDUP 1672 / SELECTION_SCROLL_LINE_SPEEDUP
1672 + 1; 1673 + 1;
1673 min_it (scroll_selection_lines, 1674 min_it (scroll_selection_lines,
1674 SELECTION_SCROLL_MAX_LINES); 1675 SELECTION_SCROLL_MAX_LINES);
1676 scroll_selection_lines *= scroll_selection_dir;
1675 } 1677 }
1676 else 1678 else
1677 { 1679 {
1678 /* we are within the text window, so we 1680 /* we are within the text window, so we
1679 * shouldn't be scrolling 1681 * shouldn't be scrolling
2195 2197
2196#ifdef MOUSE_WHEEL 2198#ifdef MOUSE_WHEEL
2197 case Button4: 2199 case Button4:
2198 case Button5: 2200 case Button5:
2199 { 2201 {
2200 int i; 2202 int lines;
2201 page_dirn v; 2203 page_dirn dirn;
2202 2204
2203 v = ev.button == Button4 ? UP : DN; 2205 dirn = ev.button == Button4 ? UP : DN;
2204 2206
2205 if (ev.state & ShiftMask) 2207 if (ev.state & ShiftMask)
2206 i = 1; 2208 lines = 1;
2207 else if (option (Opt_mouseWheelScrollPage)) 2209 else if (option (Opt_mouseWheelScrollPage))
2208 i = nrow - 1; 2210 lines = nrow - 1;
2209 else 2211 else
2210 i = 5; 2212 lines = 5;
2211 2213
2212# ifdef MOUSE_SLIP_WHEELING 2214# ifdef MOUSE_SLIP_WHEELING
2213 if (ev.state & ControlMask) 2215 if (ev.state & ControlMask)
2214 { 2216 {
2215 mouse_slip_wheel_speed += v ? -1 : 1; 2217 mouse_slip_wheel_speed += dirn;
2216 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2218 clamp_it (mouse_slip_wheel_speed, -nrow, nrow);
2217 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2218 2219
2219 if (!slip_wheel_ev.is_active ()) 2220 if (!slip_wheel_ev.is_active ())
2220 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2221 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2221 } 2222 }
2222 else 2223 else
2223# endif 2224# endif
2224 { 2225 {
2225 scr_page (v, i); 2226 scr_page (dirn, lines);
2226 scrollBar.show (1); 2227 scrollBar.show (1);
2227 } 2228 }
2228 } 2229 }
2229 break; 2230 break;
2230#endif 2231#endif
2799 }; 2800 };
2800 2801
2801void ecb_hot 2802void ecb_hot
2802rxvt_term::process_csi_seq () 2803rxvt_term::process_csi_seq ()
2803{ 2804{
2804 unicode_t ch, priv, i; 2805 unicode_t ch, priv, prev_ch, i;
2805 unsigned int nargs, p; 2806 unsigned int nargs, p;
2806 int n, ndef; 2807 int n, ndef;
2807 int arg[ESC_ARGS] = { }; 2808 int arg[ESC_ARGS] = { };
2808 2809
2809 nargs = 0; 2810 nargs = 0;
2815 /* '<' '=' '>' '?' '!' */ 2816 /* '<' '=' '>' '?' '!' */
2816 priv = ch; 2817 priv = ch;
2817 ch = cmd_getc (); 2818 ch = cmd_getc ();
2818 } 2819 }
2819 2820
2821 prev_ch = 0;
2820 /* read any numerical arguments */ 2822 /* read any numerical arguments */
2821 for (n = -1; ch < CSI_ICH; ) 2823 for (n = -1; ch < CSI_ICH; )
2822 { 2824 {
2823 if (isdigit (ch)) 2825 if (isdigit (ch))
2824 { 2826 {
2834 n = -1; 2836 n = -1;
2835 } 2837 }
2836 else if (IS_CONTROL (ch)) 2838 else if (IS_CONTROL (ch))
2837 process_nonprinting (ch); 2839 process_nonprinting (ch);
2838 2840
2841 prev_ch = ch;
2839 ch = cmd_getc (); 2842 ch = cmd_getc ();
2840 } 2843 }
2841 2844
2842 if (ch > CSI_7F) 2845 if (ch > CSI_7F)
2843 return; 2846 return;
3077 scr_insert_mode (1); 3080 scr_insert_mode (1);
3078 else if (arg[0] == 20) 3081 else if (arg[0] == 20)
3079 priv_modes |= PrivMode_LFNL; 3082 priv_modes |= PrivMode_LFNL;
3080 break; 3083 break;
3081 3084
3085 case CSI_71: // DESCUSR: set cursor style
3086 if (prev_ch == ' ')
3087 set_cursor_style (arg[0]);
3088 break;
3089
3082 /* 3090 /*
3083 * PRIVATE USE beyond this point. All CSI_7? sequences here 3091 * PRIVATE USE beyond this point. All CSI_7? sequences here
3084 */ 3092 */
3085 case CSI_72: /* DECSTBM: set top and bottom margins */ 3093 case CSI_72: /* DECSTBM: set top and bottom margins */
3086 if (nargs == 1) 3094 if (nargs == 1)
3219rxvt_term::get_to_st (unicode_t &ends_how) 3227rxvt_term::get_to_st (unicode_t &ends_how)
3220{ 3228{
3221 unicode_t ch; 3229 unicode_t ch;
3222 bool seen_esc = false; 3230 bool seen_esc = false;
3223 unsigned int n = 0; 3231 unsigned int n = 0;
3224 wchar_t string[STRING_MAX]; 3232 wchar_t string[CBUFSIZ];
3225 3233
3226 while ((ch = cmd_getc ()) != NOCHAR) 3234 while ((ch = cmd_getc ()) != NOCHAR)
3227 { 3235 {
3228 if (seen_esc) 3236 if (seen_esc)
3229 { 3237 {
3244 else if (ch < 0x20) 3252 else if (ch < 0x20)
3245 return NULL; /* other control character - exit */ 3253 return NULL; /* other control character - exit */
3246 3254
3247 seen_esc = false; 3255 seen_esc = false;
3248 3256
3249 if (n >= STRING_MAX - 1) 3257 if (n >= sizeof (string) - 1)
3250 // stop at some sane length 3258 // stop at some sane length
3251 return NULL; 3259 return NULL;
3252 3260
3253 string[n++] = ch; 3261 string[n++] = ch;
3254 } 3262 }
3371 &nitems, &bytes_after, &value) == Success 3379 &nitems, &bytes_after, &value) == Success
3372 && actual_type != None 3380 && actual_type != None
3373 && actual_format == 8) 3381 && actual_format == 8)
3374 str = (const char *)(value); 3382 str = (const char *)(value);
3375 3383
3376 tt_printf ("\033]%d;%s%c", op, str, resp); 3384 tt_printf ("\033]%d;%s%c", op, option (Opt_insecure) ? str : "", resp);
3377 3385
3378 XFree (value); 3386 XFree (value);
3379 } 3387 }
3380 else 3388 else
3381 { 3389 {
3991 break; 3999 break;
3992#endif 4000#endif
3993 } 4001 }
3994 } 4002 }
3995} 4003}
4004
4005void
4006rxvt_term::set_cursor_style (int style)
4007{
4008 if (!IN_RANGE_INC (style, 0, 4))
4009 return;
4010
4011 set_option (Opt_cursorUnderline, style >= 3);
4012
4013#ifdef CURSOR_BLINK
4014 set_option (Opt_cursorBlink, !style || (style & 1));
4015 cursor_blink_reset ();
4016#endif
4017
4018 want_refresh = 1;
4019}
3996/*}}} */ 4020/*}}} */
3997 4021
3998/* ------------------------------------------------------------------------- */ 4022/* ------------------------------------------------------------------------- */
3999 4023
4000/* 4024/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines