-
Notifications
You must be signed in to change notification settings - Fork 264
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
Word wrapping in preview #1089
Comments
Also, I have never written any Rust but can give it a shot if @sxyazi deems this feature good to have. We can also downscale the scope of this feature to a single boolean (wordwrap = true/false) in the config if it seems an overkill. All I need is my text files to word wrap as I use text preview on them daily. |
Nice to have! Would you like to raise a PR for it? Here is the method that handles code highlighting:
Maybe we can change its function signature to: pub async fn highlight(&self, skip: usize, area: Rect, wrap: bool) -> Result<Text<'static>, PeekError> { And handle text wrapping when |
Sure, will do. I'm half-way through the solution already. |
If anyone is interested in implementing it, #1142 would be a great starting point. |
I might also add that I am ready to pay a small bounty of $50 in crypto (USDC/USDT) to anyone who solves this issue without using an external crate (I don't mind if you copypaste the solution from the crate I have used in my PR). This feature is quite nice to have to me, as I use Yazi to browse a lot of personal content that is stored as separate text files which don't look good without wrapping. |
I found an issue with files that are handled by plugins, like |
Thank you, I tried it out and have left some comments! |
Thanks for the PR @ArtyomArtamonov! I'll review it ASAP |
Please describe the problem you're trying to solve
Word wrapping in preview has been a pretty contentious issue in the discussions of at least two terminal file managers. Some people like to scroll it, some people prefer it to word wrap.
Personally, I would like some of my documents to word wrap, while the others and code to not to.
I suspect, many people have their own expectations around that which I will try to address in the solution.
Would you be willing to contribute this feature?
Describe the solution you'd like
An optional "wrap" field in the previewers array in yazi.toml
True for word wrapping, false for long lines. The default is false. Ignored if the active preview is not wrappable.
Example:
Additional context
No response
The text was updated successfully, but these errors were encountered: