Open dan-da opened 1 year ago
Good question! I rarely have that many photos in one directory so I never thought about it. I typically just use Shift+PgUp in xterm to scroll back.
Idea 1: Theoretically, one could create a general pager which could read sixel data and know how many rows to scroll down. (For example, cat foo.six | identify - six:-
would work most of the time to get the pixel height).
Idea 2: Although I strive to keep lsix as simple as possible, it may make more sense to build the pager into it. My biggest problem with doing that would be that to do it right I'd need to query the terminal to find out how tall the character cell is in pixels and not all terminals handle that correctly. I could make simplifying assumptions, like having lsix prompt "More?" after every three rows no matter the terminal size or resolution, but that might feel embarrassingly kludgy.
Idea 3: Investigate how to send the proper number of newlines to the terminal such that a pager like less -r
would show the sixel images at the proper rate. Something like this, perhaps:
lsix | awk -v count=10 -v esc=$'\e' '
BEGIN { s=""; for (i=0; i<count; i++) {s=s i "\n";}
s = s "\r" esc "[" count "A" esc "P";}
{ gsub(esc "P", s esc "P");
print;
}' | less -r
Is there any way to scroll thumbnails one page at a time? If I try to pipe lsix output through
more
orless
there is just garbage, not too surprising I guess.