index
smooth scrolling in rxvt
how to keep reading while scrolling
This page contains patches to make scrolling inside rxvt comparable with smooth-scrolling in firefox.
WARNING: it is incompatible with LCD screens :( Read why in this excellent article by Dave Marsh, about eyes & monitors.
Table of Contents
- why did i set to implement it
- bugs to consider before
- story how it got implemented
- download the patches
- demo: a demo for Sawfish users, no need to (re-)compile!
News!
- I have a patch for less to use smooth-scroll feature of my rxvt. (that means also man(1)).
- rxvt's own scrolling (by Shift-Up/Down) uses it too! (code not yet published)
- GKT+ is working on it too:
Why?
I find it useful to use text-only elinks web browser instead of firefox. (I use it for html documentations, and wsws).
But web pages are more than 1 page, and i need to scroll. Firefox has a nice smooth scrolling (now smooth-wheel) , and I think,
that given a good keyboard control, with smooth scrolling it is possible to read while scrolling.
Text scrolling by line-height skips is disturbing; but ending titles in films are readable!
Bugs:
If the rxvt window is not fully visible (partially obscured), wrong pixels will scroll. Particular case is
described here. Hard to solve for now, i should avoid the trick when partially obscured.
- Inside elinks it does not work with html frames, when you scroll only one of them :(
- new problem: XCopyArea on small windows is too fast, so i should interleave it w/ some delays.
History
While hacking on rxvt I got a diabolic idea: scroll by pixels, rather than by text lines.
Simple to state, but it needed some preparation.
I knew the "difference" algorithm (pdf), but this needed a different one: heckel algorithm. I couldn't find free documentation, so
I took some free implementation and read it till I understood, that "heckel" algo is about heuristics, it does not
solve e well defined problem. It is used in ncurses,
I want this algo to find out a "scroll similarity" between 2 sequences of text.
But first a bit of background:
- Elinks often redraws screen by pushing full page redrawing sequence (program).
- such program starts with clear-screen instruction.
- in October 2005, I was solving problems around flickering. I disliked the flicker due to that clear-screen
instruction.
I wanted rxvt to keep a snapshot of the screen, and render only the "final" image. The finality had
to be signalled by elinks, by the second Esc. seq. I call them freeze and unfreeze "rxvt commands": escape
sequences.
- But, at the moment of unfreeze I was able to test for scrolling & do the smooth scroll.
Formulation of the problem:
- First I had to detect which part of screen was scrolling, and what was the shift (in text line units).
- by using XCopyArea do a series of micro-scrolls.
solution:
- When I feed the Xserver with the sequence of XCopyArea calls, it is not fast as I would have wished for.... by which
I mean I didn't have to interleave them with some pauses. The speed is just fine on my
matrox G450 @ 1920x1440 (bandwidth 2.7GB/sec) & amd 1700 xp. That's just a lucky combinationn in my case.
- After using (for a month) a version which tested for shift by -2 (text scrolling up in elinks), I implanted (in
rxvt) my simplified version of heckel algo, and obtain the shift/scroll number, and 3 regions: top & bottom group of
linese which don't scroll, and the rest which scrolls (there is a minimum percentage of lines which need to do the same
movement, below which I don't use the scrolling).
Response
as is the tradition on #rxvt-unicode I didn't get any positive feedback: see irc log
patches
FAQ:
- keyboard Auto-repeat is faster than the rendering, so after a while the page makes a skip.
Fine-scrolling is invoked only when the scroll step is less than 10 lines (up- or down-wards). I suggest setting they key-repeat
low enough, so that you can just keep the key down and see the page flow. I use
xset r rate 190 10
for the elinks window, while 190 40 for others. I have that tuning done automatically by my Sawfish (window manager)
Todo:
Demo for Sawfish users:
I changed a bit the slide-window function to use microsteps.
http://www.ruska.it/comp/activity/sawfish/wm/commands/slide-window.jl
but there has been a similar code in another sawfish extension! http://djdeath91.dyndns.org/~djdeath/animate-move.jl
Page started 8/1/2006