diff --git a/ChangeLog b/ChangeLog index ff873c0..e7aaa81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3347,3 +3347,16 @@ Tue Mar 14 19:11:26 PST 2000 Michael Jennings in the pasting code. ------------------------------------------------------------------------------- +Fri Mar 17 18:27:51 PST 2000 Michael Jennings + + I added accelerated scrollwheel support. I also added a #define in + src/feature.h for specifying the number of lines of context to keep + when paging up or down. + + Also, we're back to the old behavior where home on input won't be + triggered unless the key pressed has an associated string value. I + went back on this because Shift causing a jump to the bottom was + really annoying when trying to Shift-PgUp or Shift-PgDown. Sorry, + Darren, but you lose. + +------------------------------------------------------------------------------- diff --git a/src/events.c b/src/events.c index f2bd9ea..2149641 100644 --- a/src/events.c +++ b/src/events.c @@ -615,23 +615,42 @@ handle_button_press(event_t * ev) } else { switch (ev->xbutton.button) { case Button1: - if (button_state.last_button_press == 1 - && (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) + if ((button_state.last_button_press == 1) && (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) { button_state.clicks++; - else + } else { button_state.clicks = 1; + } selection_click(button_state.clicks, ev->xbutton.x, ev->xbutton.y); button_state.last_button_press = 1; break; case Button3: - if (button_state.last_button_press == 3 - && (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) + if ((button_state.last_button_press == 3) && (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) { selection_rotate(ev->xbutton.x, ev->xbutton.y); - else + } else { selection_extend(ev->xbutton.x, ev->xbutton.y, 1); + } button_state.last_button_press = 3; break; + case Button4: + if ((button_state.last_button_press == 4) && (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) { + button_state.clicks++; + } else { + button_state.clicks = 1; + } + button_state.last_button_press = 4; + scr_page(UP, ((ev->xbutton.state & ShiftMask) ? (1) : (TermWin.nrow - CONTEXT_LINES)) * ((button_state.clicks > 1) ? 3 : 1)); + break; + case Button5: + if ((button_state.last_button_press == 5) && (ev->xbutton.time - button_state.button_press < MULTICLICK_TIME)) { + button_state.clicks++; + } else { + button_state.clicks = 1; + } + button_state.last_button_press = 5; + scr_page(DN, ((ev->xbutton.state & ShiftMask) ? (1) : (TermWin.nrow - CONTEXT_LINES)) * ((button_state.clicks > 1) ? 3 : 1)); + break; + default: break; } } button_state.button_press = ev->xbutton.time; @@ -687,12 +706,7 @@ handle_button_release(event_t * ev) case Button2: selection_request(ev->xbutton.time, ev->xbutton.x, ev->xbutton.y); break; - case Button4: - scr_page(UP, (ev->xbutton.state & ShiftMask) ? 1 : 5); - break; - case Button5: - scr_page(DN, (ev->xbutton.state & ShiftMask) ? 1 : 5); - break; + default: break; } } } diff --git a/src/feature.h b/src/feature.h index 1923dc2..b2faf2e 100644 --- a/src/feature.h +++ b/src/feature.h @@ -189,6 +189,9 @@ /* #define SCROLLBAR_INITIAL_DELAY 40 */ /* #define SCROLLBAR_CONTINUOUS_DELAY 2 */ +/* How many lines of context to keep on screen when paging up/down */ +#define CONTEXT_LINES 1 + /********************* Multi-lingual support options *********************/ /* Allow option/attribute for Meta to set the 8th bit */ diff --git a/src/term.c b/src/term.c index 91f7d97..2b64aea 100644 --- a/src/term.c +++ b/src/term.c @@ -259,9 +259,15 @@ lookup_key(XEvent * ev) if (action_dispatch(ev, keysym)) { LK_RET(); } - /* If we're in pause mode, exit. */ - if (len && keypress_exit) { + if (len) { + /* If we're in pause mode, exit. */ + if (keypress_exit) { exit(0); + } + /* Only home for keypresses with length. */ + if (Options & Opt_home_on_input) { + TermWin.view_start = 0; + } } /* This is a special mode that reports all extended keysyms (above 0xff00) to the application @@ -290,26 +296,17 @@ lookup_key(XEvent * ev) keysym += (XK_F11 - XK_F1); shft = 0; } else if (!ctrl && !meta && (PrivateModes & PrivMode_ShiftKeys)) { - - int lnsppg; /* Lines per page to scroll */ - -#ifdef PAGING_CONTEXT_LINES - lnsppg = TermWin.nrow - PAGING_CONTEXT_LINES; -#else - lnsppg = TermWin.nrow * 4 / 5; -#endif - switch (keysym) { case XK_Prior: /* Shift-PgUp scrolls up a page */ if (TermWin.saveLines) { - scr_page(UP, lnsppg); + scr_page(UP, (TermWin.nrow - CONTEXT_LINES)); LK_RET(); } break; case XK_Next: /* Shift-PgDn scrolls down a page */ if (TermWin.saveLines) { - scr_page(DN, lnsppg); + scr_page(DN, (TermWin.nrow - CONTEXT_LINES)); LK_RET(); } break; @@ -337,14 +334,14 @@ lookup_key(XEvent * ev) switch (keysym) { case XK_Prior: if (TermWin.saveLines) { - scr_page(UP, TermWin.nrow * 4 / 5); + scr_page(UP, TermWin.nrow - CONTEXT_LINES); LK_RET(); } break; case XK_Next: if (TermWin.saveLines) { - scr_page(DN, TermWin.nrow * 4 / 5); + scr_page(DN, TermWin.nrow - CONTEXT_LINES); LK_RET(); } break; @@ -378,11 +375,6 @@ lookup_key(XEvent * ev) break; } - /* If we get this far, the keypress had no special meaning to us. */ - if (Options & Opt_home_on_input) { - TermWin.view_start = 0; - } - /* Process extended keysyms. This is where the conversion to escape sequences happens. */ if (keysym >= 0xff00 && keysym <= 0xffff) { #ifdef KEYSYM_ATTRIBUTE