Skip to content

variant of 'scrolled-by' which counts text lines instead of screen lines #4462

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

Closed
omgold opened this issue Jan 7, 2022 · 2 comments
Closed

Comments

@omgold
Copy link

omgold commented Jan 7, 2022

When launching a program and passing it the scrollback buffer (e.g. to copy text to selection via keyboard), to scroll the editor identically to the terminal, the variable @scrolled-by can be passed on the commandline of the executed program.

This only works correctly, though, when the editor counts lines the same way as the terminal. It seems @scrolled-by counts screen lines, but editors tend to count lines of the passed text (effectively the number of newline characters). With unicode, double-width characters and such, the translation between these line counts is far from trivial to do in a wrapper script.

Sure, one can use --stdin-add-line-wrap-markers, but for copying multi-line text, this is not desirable.

Thus I think adding variables that allow to pass "topmost text line on the screen" and "bottommost text line on the screen" (with respect to the current scrolling) would be useful to have.

@page-down
Copy link
Contributor

page-down commented Jan 7, 2022

I also encountered this issue when using the custom pager feature.

Due to the differences between the pager program and the kitty scrollback in terms of counting lines and handling Unicode characters, it is impossible to accurately locate the line at the start of the screen.

scrollback_pager /path/to/pager.sh 'INPUT_LINE_NUMBER' 'CURSOR_LINE' 'CURSOR_COLUMN'

@page-down
Copy link
Contributor

@florian-hild

You are looking for KiTTY, a fork of PuTTY.

https://github.com/cyd01/KiTTY

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