Commit 3cd76488 authored by gi1242's avatar gi1242

Added patch by Jim Diamond: Makes the Scroll macro accept a '%' suffix...

Added patch by Jim Diamond: Makes the Scroll macro accept a '%' suffix allowing one to scroll by a percentage of the current page size.
parent 86c8b63d
......@@ -1694,13 +1694,23 @@ is relative to the current tab.
.It Ic Scroll Ar amount
Scroll the active tab by
.Ar amount
lines (negative values mean scroll backward). If
lines (negative values mean scroll backward). If
.Ar amount
ends with
.Sq p
then scroll
.Ar amount
pages instead of lines.
pages instead of lines. If
.Ar amount
ends with
.Sq %%
then scroll
.Ar amount
percent of a page. For example,
.Ar -50%%
would scroll backwards one half of the current page size. (Note, we need to use two percent signs, as macro arguments are percent interpolated. Thus putting only one percent sign, will work, but cause
to print a warning about an unrecognized flag)
.\" ------------------------------------------------------------
.It Ic Copy
Copy selection into clipboard (not implemented).
......@@ -1008,12 +1008,13 @@ rxvt_dispatch_action( rxvt_t *r, action_t *action, XEvent *ev)
/* Scroll by an amount specified in astr */
if( alen > 1 )
int amount = abs( atoi( (char*) astr ));
char *suffix;
int amount = abs(strtol( astr, &suffix, 0 ));
enum page_dirn direction = (*(astr) == '-' ? UP : DN);
rxvt_dbgmsg ((DBG_DEBUG, DBG_MACROS, "astr: '%s', alen: %d\n", astr, alen));
if( tolower( astr[ alen - 2] ) == 'p' )
if( tolower( *suffix ) == 'p' )
/* scroll pages */
amount *=
......@@ -1022,8 +1023,15 @@ rxvt_dispatch_action( rxvt_t *r, action_t *action, XEvent *ev)
r->TermWin.nrow * 4 / 5
else if( tolower( *suffix ) == '%' )
* 2008-08-04 Jim Diamond: Scroll as a perCent of the
* current window size.
amount = amount * r->TermWin.nrow / 100;
rxvt_scr_page(r, ATAB(r), direction, amount);
rxvt_scr_page( r, ATAB(r), direction, amount);
rxvt_scrollbar_update(r, 1);
# endif /* HAVE_SCROLLBARS */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment