edenzik / macvim

Automatically exported from code.google.com/p/macvim
0 stars 0 forks source link

Arabic support in macvim #256

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It seems that macvim does not  have support for right to left languages 
(arabic, hebrew...) 
whereas, the version of vim provided with osX (using the term app) does not 
have that kind of 
issues.

What version of MacVim and OS X are you using (see "MacVim->About MacVim"
and  "Apple Menu->About This Mac" menu items, e.g. "Snapshot 40, 10.5.6
Intel")?

MacOsX 10.5.8
MacVim 7.2 (51)  

Please provide any additional information below.

Original issue reported on code.google.com by tariklu...@gmail.com on 17 Feb 2010 at 2:58

GoogleCodeExporter commented 9 years ago
What is missing?  ":set rl" works for me...

Original comment by bjorn.winckler@gmail.com on 17 Feb 2010 at 3:18

GoogleCodeExporter commented 9 years ago
Ok, set rl works.
But when you are in RL mode all the text in roman is inverted also. So you 
can't mix roman and arabic text. 
Whereas with the vim included with osx, in the terminal, you can stay in 
standard mode, and display correctly 
arabic text mixed with roman.
I don't know which behaviour is expected and why is it different between mvim 
and vim.

Original comment by tariklu...@gmail.com on 18 Feb 2010 at 2:28

GoogleCodeExporter commented 9 years ago
Can you give me a step-by-step example of something that "works" in the version 
of Vim that comes with Mac 
OS X?  The thing is, that version does not even support (Vim's version of) 
right-to-left editing (which you can see 
by typing :ver inside Vim and noting that it says "-rightleft" whereas in 
MacVim it says "+rightleft").

The way right-to-left editing works in MacVim is the same as in Gvim on Windows 
-- this is how it is supposed 
to work in Vim.  What you are seeing in the Terminal version probably has 
something to do with the text 
rendering technologies in Mac OS X but until you give me some examples to try I 
can't say that is the case for 
sure.

Original comment by bjorn.winckler@gmail.com on 18 Feb 2010 at 5:01

GoogleCodeExporter commented 9 years ago
Ok,
Herre is an exemple:

Create a file containing this sample text:
"Roman text نص عربي "
  - copy this text in safari
  - in the term app create a file using vim ( vim foo.txt)
  - in insert mode, past the text using cmd-v or the menus in the term
  - save the file 
In the term app the roman and arabic parts looks ok. You can even do a "cat 
foo.txt" it will display correctly.
You can also open it in textedit by specifying utf8 as text encoding. It will 
display correctly.

Now, if you try to open the file with macvim you'll see that the arabic part 
does not display correctly. The 
lettres are good, but displayed from left to right with ligatures it seems 
different and it is completely 
unreadable.

When you activate the LR mode in macvim, the arabic part display well but now 
its the roman part that is 
completely reversed.

Maybe it is not a "macvim issue" but something more general with the way vim 
deals with right to left 
languages but I was just surprised by the difference in behavior between the 
two version of vim on osX

ps. I have added screenshots of this tests.

Original comment by tariklu...@gmail.com on 18 Feb 2010 at 7:00

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the example.

Unfortunately, it is as I thought: RL rendering does not quite work in Terminal 
Vim even if at first it may seem 
that way.  To see this:
1. paste your sample text into Vim
2. yank the line and paste it again
3. on the second line press "x" repeatedly to delete the Roman text
4. go into the middle of the Arabic text and type ixxxxxxx
5. undo the change in 4 and repeat 4-5

You'll see that after a while the Arabic text gets completely messed up and 
sometimes displayed on top of the "x" characters that you enter in step 4.  
(You can probably recreate this problem in a simpler fashion, but the 
above steps always reproduced the problem for me.)

The thing is this: the Mac OS X font rendering technology will display RL 
scripts in a right to left fashion 
automatically even when mixed with LR scripts.  However, the way Vim does 
rendering is incompatible with 
this technology which is why it is quite easy to break the rendering as in the 
example above.

To conclude: MacVim's RL editing is "as good as it gets" in Vim (it is this way 
by design).  If you want the type 
of mixed Roman/Arabic editing you describe then you'll have to use another 
editor. :(

Original comment by bjorn.winckler@gmail.com on 19 Feb 2010 at 7:30