FarGroup / FarManager

File and Archive Manager
https://farmanager.com
BSD 3-Clause "New" or "Revised" License
1.82k stars 203 forks source link

Strip/Replace Unicode control characters (such as right-to-left) from file names (during rendering) #871

Open yegor-mialyk opened 2 months ago

yegor-mialyk commented 2 months ago

Description of the new feature or improvement

Strip/Replace Unicode control characters (such as right-to-left) from file names (technically any string) during rendering:

Abbreviation Name Description
LRE U+202A LEFT-TO-RIGHT EMBEDDING Try treating following text as left-to-right.
RLE U+202B RIGHT-TO-LEFT EMBEDDING Try treating following text as right-to-left.
LRO U+202D LEFT-TO-RIGHT OVERRIDE Force treating following text as left-to-right.
RLO U+202E RIGHT-TO-LEFT OVERRIDE Force treating following text as right-to-left.
LRI U+2066 ⁦ LEFT-TO-RIGHT ISOLATE Force treating following text as left-to-right without affecting adjacent text.
RLI U+2067 ⁧ RIGHT-TO-LEFT ISOLATE Force treating following text as right-to-left without affecting adjacent text.
FSI U+2068 ⁨ FIRST STRONG ISOLATE Force treating following text in direction indicated by the next character.
PDF U+202C POP DIRECTIONAL FORMATTING Terminate nearest LRE, RLE, LRO, or RLO.
PDI U+2069 ⁩ POP DIRECTIONAL ISOLATE Terminate nearest LRI or RLI.
... ... ...

A sample file name:

[U+202E]test.txt

Rendered in Far Manager:

image

In Windows Terminal:

image

Proposed technical implementation details (optional)

No response

HamRusTal commented 2 months ago

I suggest that FAR users from Israel (e.g. @shmuz, @trexinc) review the resulting functionality first with regard to Hebrew.

(technically any string)

Also, I'd like to know how the change will affect rendering of e.g. descriptions (assuming text editor and viewer are not affected).