Porting this to the K3 shows a little bug in my original code. I did not notice it on the K4 and Touch because it gave a reasonable value for "max stride", but on the K3 it is obviously only half the screen. Fixing it actually made the code a little simpler and a little smaller. I like that!
And the fact that it works on all the (tested) kindle models with NO CHANGES means that we did *something* right.
Change this line:
MX=$((FW*FS/FW-CW)) ML=$(((FH-TM)/LH-1)); MS=$((ML+FS)) # max X, line, stride
to this:
MX=$((FW-CW)) MY=$((FH-LH)) # max X, Y
and change the "last line" checks to use
$MX instead of
$MS.
EDIT: Tested and working on my DX, DXG, K3, K4, and Touch, using this command:
eips -c;hexdump -C /dev/urandom|./titty -
which fills all available lines on the screen with a hexdump of random data, and then quits. On the DXG, it stops after the last full line on the larger screen. And while displaying itself, the MIT license wraps at the larger screen right margin. It is nice when things actually work as designed without needing a lot of little bug fixes.
UPDATE: Original "titty" post updated to v1.4 (which includes above changes):
EDIT: Now I tested the scrolling with v1.4 (posted above) on my DX, and that works too. On a DX 824x1200 display, that is 206 columns of readable tiny text, or 300 columns wide if we used landscape mode. In DX landscape mode, we could display 4 side-by-side pages of 75-character lines, or 3 pages of 100-character lines. Cool. Now all we need is 3 or 4 open text console windows side-by-side. We could also split the screen in half along the other direction and get 6-up or 8-up text console windows on the DX display.