Closed amraymanaly closed 2 months ago
I don't know FriBiDi, it would help if you could explain what it is and what Yazi can do here
FriBiDi is GNU's implementation of the standard bidirectional text algorithm. It takes unicode RTL text and renders it properly. If the characters are in the simple Latin range, or the slightly wider LTR characters range, it does nothing. Hence it's a harmless and useful addition to pipe all text through the algorithm before rendering.
This is important to me because I have Arabic files/directories and Arabic content, so it messes with my directory listings and the content preview.
I think this is a bit beyond the scope of Yazi, as it involves text layout. Yazi being a TUI app, doesn't handle that directly and relies on the UI library Ratatui.
If you just want to deal with the filename part, you could try rewriting the Entity:highlights()
method, where you can access the file name through self._file.name
and perform any processing or conversion. Here's a simple example:
-- ~/.config/yazi/init.lua
function Entity:highlights()
return ui.Line("You can return anything you want here")
end
However, content preview is still tricky because it's not just a Line
like the filename but a Paragraph
, which requires the appropriate API from Ratatui. Fortunately, I found an issue discussing this: https://github.com/ratatui/ratatui/issues/756.
Implementing this on the Yazi side would be quite complex; we might need to iterate over each Paragraph
and calculate their content size before Ratatui renders them, which would turn the original single render into two renders. Since Yazi doesn't have complete info on each Paragraph
, it would need to render them again. So, I'll close this issue as it's beyond Yazi's scope.
I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please file a new issue and complete the issue template so we can capture all the details necessary to investigate further.
yazi --debug
outputPlease describe the problem you're trying to solve
For simple programs, I can generally pipe their output to
fribidi
, which does the rendering of Arabic text correctly. However, I can't just do that with a complex program likeyazi
. There doesn't seem to be a way to extend it with lua to achieve this.Would you be willing to contribute this feature?
Describe the solution you'd like
Either use FriBiDi headers directly in code, perhaps through c, or a simple pipe to the
fribidi
executable before rendering text, which is a lot less efficient.Additional context
No response
Validations