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

[Feature request] Add ability to set maximum line width #97

Closed
asb opened this issue Mar 26, 2023 · 6 comments · Fixed by #171
Closed

[Feature request] Add ability to set maximum line width #97

asb opened this issue Mar 26, 2023 · 6 comments · Fixed by #171

Comments

@asb
Copy link

asb commented Mar 26, 2023

Currently, text will be wrapped at the width of the terminal window. Ideally I could set a maximum width (and even better if this maximum width was ignored for fenced code blocks).

@sigoden
Copy link
Owner

sigoden commented Mar 26, 2023

Do you mean no-wrap and horizontal scrolling?

Normal text wrapping is more appropriate.
And the fenced code blocks replied by gpt are usually not very wide.

Given this, I'm not going to add this feature.

@asb
Copy link
Author

asb commented Mar 26, 2023

No, I meant setting a maximum width of e.g. 80, or 120 characters and having the text wrapped at that width, even if the terminal window is wider.

@sigoden sigoden added the enhancement New feature or request label Mar 26, 2023
@sigoden
Copy link
Owner

sigoden commented Mar 26, 2023

This introduce a problem: text copied to from terminal selection may be broken.

For example.

let text = "Lorem ipsum dolor sit amet. Morbi et lobortis nisi, at ullamcorper sem. Vestibulum semper diam nec nulla
tempor dictum. Sed vitae placerat tortor. In ut convallis sapien. Fusce non scelerisque sapien. "

In order to meet the max-width limit, Aichat may insert line break: nulla tempor => nulla\n tempor.

If we copy this text and run

image

@sigoden
Copy link
Owner

sigoden commented Mar 26, 2023

Technically, a vim-like tui application takes over the terminal, which handles the copying itself. This way you can copy the original text from the selected text.
Aichat uses readline, and copy section is a built-in function of the terminal, which can only copy the text output by Aichat as it is.
So you only copy corrupted text.

@sigoden
Copy link
Owner

sigoden commented Mar 26, 2023

text-wrap of #99 has the same problem.

@sigoden sigoden removed the enhancement New feature or request label Mar 26, 2023
@asb
Copy link
Author

asb commented Mar 27, 2023

So you only copy corrupted text.

That was the motivation for suggesting not to wrap code blocks. Code blocks remain easily copyable, but paragraphs of explanation are more readable. This very roughly approximates the rendering within a browser.

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

Successfully merging a pull request may close this issue.

2 participants