Monday, February 21, 2011

Re: bidi in vim

* Ben Schmidt <mail_ben_schmidt@yahoo.com.au> [20/02/11 03:21]:
> On 20/02/11 4:12 AM, Moshe Kamensky wrote:
> > Hi There,
> >
> > I am interested in writing bidirectional text in Vim. I realise, from
> > previous discussions on the list, the it would be difficult to support
> > the bidi standard in Vim. However, I was wondering if a more manual
> > approach would be easier to implement. What I had in mind was to extend
> > the syntax highlighting system, to allow specifying the direction of a
> > syntax region. This would mean that the direction of a character is
> > determined by its syntax group, so no implementation of the bidi
> > algorithm is necessary. Of course, displaying a string in the correct
> > direction is more complicated than highlighting with a given colour, but
> > perhaps it is easy enough (I'm not familiar with the code).
> >
> > If this can be done, I think it will solve most practical problems,
> > since when editing latex, for example, text in different direction will
> > appear in particular commands or environments.
> >
> > Thanks,
> > Moshe
>
> I like the idea of bidi in Vim, but I'd rather see it done right or not done at
> all. We don't need another hacky half-job which will end up with workarounds built
> on top of workarounds etc.. We have too many of those already.
>
> Just my $0.02.
>
> Ben.
>

Of course I also would prefer to have full bidi support, but I can also
see that this would require some serious changes and complications in
the code, and even if this is done, there will probably be a rather
serious performance penalty (for instance, the full bidi algorithm works
on whole paragraphs, so you would have to compute something for the
whole paragraph for every keystroke).

I also don't see that what I'm suggesting is a hack or a workaround. It
could actually be part of a general mechanism: for instance, the
highlight or the syntax command could take a function as an optional
argument. This function will be called with the start and end of the
corresponding region (and maybe other arguments) and will output a new
string to be displayed instead of the original one. This way the
reversing can be done in Vim language (and you could use this system for
other purposes, for instance capitalise all text in the region).

Moshe

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: