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

Wordwrap content so it'll fit current terminal dimensions? #3

Open
asincero opened this issue May 22, 2019 · 2 comments
Open

Wordwrap content so it'll fit current terminal dimensions? #3

asincero opened this issue May 22, 2019 · 2 comments

Comments

@asincero
Copy link

Is it possible to have pypager word wrap the content being displayed so it'll fit the terminal's current column dimensions? Kind of like how 'less' can.

@jonathanslenders
Copy link
Member

Hi @asincero,

I'm sorry for the late reply, I just notice this issue right now.
Yes - this should be possible. Prompt_toolkit has the needed line wrapping functionality already implemented. The following patch would always enable line wrapping:

diff --git a/pypager/layout.py b/pypager/layout.py
index 1f09396..c475811 100644
--- a/pypager/layout.py
+++ b/pypager/layout.py
@@ -228,6 +228,7 @@ def create_buffer_window(source_info):

     return Window(
         always_hide_cursor=True,
+        wrap_lines=True,
         content=BufferControl(
             buffer=source_info.buffer,
             lexer=source_info.source.lexer,

Ideally, it should be a boolean configured in _SourceInfo, be off by default and toggleable with some shortcut.

@jonathanslenders
Copy link
Member

This PR should do it: https://github.com/prompt-toolkit/pypager/pull/9/files
If you have some time, can you try that?

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

No branches or pull requests

2 participants