Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define the scroll area to preserve horizontal and vertical header. #43

Closed
gschadow opened this issue Jan 17, 2020 · 1 comment
Closed

Comments

@gschadow
Copy link

gschadow commented Jan 17, 2020

We use less with psql (and mysql and whatever other database tools), for an example see A better psql with less.. Now wouldn't it be nice if we could fix the header line so as to scroll only in the region below line 2? But then comes horizontal scrolling, where you would want to scroll the horizontal header along with the body. And once you have that, you'd want a vertical header also, where horizontal scrolling would begin at, for example, column 10, while vertical scrolling would scroll that vertical header just like horizontal scrolling would scroll that horizontal header.

Think of Excel Window -> Freeze Pane setting.

So this could be using the option --freeze-pane 10,2, for example, where 10,2 means 10 columns from the left of vertical header and 2 lines from the top of horizontal header, so that the scroll area is starting from 11,3.

Here are relevant questions about this subject on stackexchange:

UPDATE: adding some example:

 foo | bar | baz | zebra | zoo
-----+-----+-----+-------+-----
   1 |   2 |   3 |     3 |   4
   4 |   5 |   6 |     9 |  10
   7 |   8 |   9 |    15 |  16
  10 |  11 |  12 |    21 |  22
  13 |  14 |  15 |    27 |  28
  16 |  17 |  18 |    33 |  34
  19 |  20 |  21 |    39 |  40
  22 |  23 |  24 |    45 |  46
  25 |  26 |  27 |    51 |  52

now let's say our terminal is only 20 columns by 9 lines, so it would show:

 foo | bar | baz | z
-----+-----+-----+--
   1 |   2 |   3 |
   4 |   5 |   6 |
   7 |   8 |   9 |
  10 |  11 |  12 |
  13 |  14 |  15 |
  16 |  17 |  18 |
lines 1-8

now if I scroll right and down I see this

   6 |     9 |  10
   9 |    15 |  16
  12 |    21 |  22
  15 |    27 |  28
  18 |    33 |  34
  21 |    39 |  40
  24 |    45 |  46
  27 |    51 |  52
lines 4-11/13 97%

but if I has been able to set the --freeze-pane 0,2 then the window would look like this:

 baz | zebra | zoo
-----+-------+-----
  12 |    21 |  22
  15 |    27 |  28
  18 |    33 |  34
  21 |    39 |  40
  24 |    45 |  46
  27 |    51 |  52
lines 4-11/13 97%

and if I has been able to set the --freeze-pane 6,2 then the window would look like this:

 foo | zebra | zoo
-----+-------+-----
   1 |    21 |  22
   4 |    27 |  28
   7 |    33 |  34
  10 |    39 |  40
  13 |    45 |  46
  16 |    51 |  52
lines 4-11/13 97%
@gwsw
Copy link
Owner

gwsw commented Aug 30, 2021

Addressed by the --header option in less-593.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants