GithubHelp home page GithubHelp logo

paging support about lsix HOT 1 OPEN

hackerb9 avatar hackerb9 commented on July 19, 2024
paging support

from lsix.

Comments (1)

hackerb9 avatar hackerb9 commented on July 19, 2024

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

from lsix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.