On 02/07/09 20:03, Bram Moolenaar wrote:
>
>
> Adriaan Pater wrote:
>
>> When I open a UTF-text file with right-to-left-text (hebrew in this
>> case) and left-to-right-text (english in this case) in gedit it is
>> rendered OK (rtl is displayed as rtl, ltr is displayed as ltr).
>>
>> But when I open the same file in gvim the right-to-left text (hebrew) is
>> showed as left-to-right text (just as the rest of the file, cq. english).
>>
>> Is there a way to get the same behaviour as in gedit?
>>
>> I searched for :help already and found things like mlterm, termbidi, set
>> bomb etc. but I just can't gvim to show the text like gedit.
>
> No, the whole text is either LTR or RTL.
>
> I have never understood why people put the text in the wrong order in
> the file and then change the order when displaying it.  The characters
> should be in the file in the order they are displayed.
>
> Perhaps there is a filter that change the order for this kind of file.
>

If you put the characters into the file in the order they are displayed 
regardless of the order they are pronounced, you'll get no end of 
trouble when trying to reformat (to wider or narrower width) paragraphs 
containing sentences (or book titles etc.) in both directions, or even 
text containing separate paragraphs (quotations...) in the opposite 
direction. To reformat text with mixed LTR and RTL paragraphs you'll 
need to (1) reverse the order of characters in every "wrong-direction" 
line; (2) reformat; (3) reverse again. If you have paragraphs in one 
direction with at least two consecutive words in the opposite direction, 
you'll have to take care of all the possibilities of line breaks coming 
and going in the middle of the "wrong-direction" text.

The "right" sequence of letters in a file consists of putting the start 
of every word before its end, and the words of every sentence in the 
order they are pronounced. Then the reordering happens when displaying, 
_after_ deciding where line breaks (if any) have to come. IIUC the worst 
headbreaker in that respect lies in the scripts specific to the Indian 
subcontinent (not yet supported by Vim), which are LTR on the whole, but 
with some vowels written to the left of the consonant which comes before 
them.

Vim can display _each window_ as either LTR or RTL but not both, use 
":setlocal invrightleft" to toggle. |'rightleft'| Unless you are running 
Console Vim in a true-bidi terminal, in which case (IIUC) setting 
'termbidi' tells Vim that the terminal, not Vim, is in charge of bidi 
display, Arabic shaping, etc.

If I have an English or French paragraph with one word in Hebrew or 
Arabic, I'll keep it in 'norightleft' and know that gvim displays the 
RTL word "the wrong way". Conversely for Arabic (RTL) text maybe 
including some numbers (LTR even with Arabic-Indic digits), where I'll 
use 'rightleft' and know that the numbers are displayed in gvim with the 
digits reversed. OTOH if I have a file with long sentences in both LTR 
and LTR I'll maybe display it in two split-windows, one of them 
'rightleft' and the other 'norightleft'. Or else, I'll be busy with only 
one language at a time and orient the window accordingly.

What I do to view (or print) a text (or HTML) file with mixed LTR and 
LRT text is save it to disk, then display it in my favourite browser. 
Thus Hebrew and Arabic appear right-to-left, English etc. appear 
left-to-right and mixed-direction paragraphs are handled properly.


Best regards,
Tony.
-- 
Naeser's Law:
        You can make it foolproof, but you can't make it
damnfoolproof.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to