[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Display hide a char ?



Nadim Shaikli wrote:

> Bram - I've been giving some thought to the Arabic requirement in which
> some characters need to be combined in order to make them readable and
> correct (namely LAM-ALEF --> LAA or in encodings 0x644, 0x0627 --> 0xfefb).
> Its a nicety that a number of people have repeatedly asked for :-)
> 
> I realize that you are not familiar with Arabic, as such - I'd like to
> offer an example with pseudo-characters.
> 
> Let's assume I have these two Arabic characters 'A' and 'B' which are
> valid characters when they are not next to each other - but when I
> put AB (A followed by B), I'm supposed to see 'C' and NOT simply 'AB'.

Can't you replace the "AB" in the text with "C"?  Then the displaying
can remain the same, the only trick is to handle the case where a "B" is
entered after an "A".  And perhaps doing the reverse when using a
backspace.

It sounds similar to what is done for composing characters.  You might
want to look into that code.  This means moving the "B" to become a
composing character of "A", which together form "C".  Then the code that
knows about this is restricted to where composing characters are
handled.

> After some studying and adding a bit to the vim code already, I was
> thinking of a solution along the lines of something that would fit-in
> with the existing vim code.  A new "attribute" call it 'display-skip'
> (pick any encoding that makes sense) would be nice to have which would
> let the display engine to simply pass-over that array element whenever
> it sees it (ie. a new encoding to ScreenAttrs[] or another global array)
> without advancing the display cursor.

That sounds complicated.  In many places the cell-width of a character
is computed and used.  You would need to have a character of zero cell
width, which causes all kinds of trouble.

-- 
In Joseph Heller's novel "Catch-22", the main character tries to get out of a
war by proving he is crazy.  But the mere fact he wants to get out of the war
only shows he isn't crazy -- creating the original "Catch-22".

 ///  Bram Moolenaar -- Bram at moolenaar dot net -- http://www.moolenaar.net  \\\
///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
\\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///