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

Re: Display hide a char ?



On Wed, 06 Mar 2002 22:08:48 +0100
  "Bram Moolenaar" wrote:
> 
> 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.

The one case that I do care about is the "trick" you note above :-)

> 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.

Its not at all similar in the sense that we are not asked to superimpose
those two glyphs (which is what composing characters tend to do).  So the
idea is somewhat similar conceptually, but the execution of it is far from
being the same.  The 'C' in question is a completely different glyph in
its own right (again this is only to be done on display).  If I'm jumping
to conclusions, do let me know.

> > 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.

Everything related to Arabic is complicated ;-)

Oh well, sounds like lots more hacking for me to muck with -- it seems like
there are bits and pieces of it here and there (without having to resort to
0 cell-widths) -- I'm a bit confused about all the column widths and whether
its possible to advance one column without the others (they all seem to want
to tie to each other).

I'm talking specifically about (display vs. window vs. buffer, etc),

   w_cursor.col
   w_curswant
   w_virtcol
   w_wcol
   etc :-)

[A few hours later...]

OK, let's simplify this and remove the "arabic" notion from any of this.

Let's assume I want to do the following,

  user enters -> "WXYZ"
  user sees   -> "WYZ"  (note, no X)

certainly that's doable in vim (dynamically, ie. no replace post fact - the
'X' should simply not be shown and no keyboard/keymap tricks either, I'm
looking for a vim code solution for this).  What happens now is (with some
hacking),

  now in vim  -> "W YZ" (note, space)

How can I (without touching cell-widths) tell VIM to not display that
space ?  This would certainly come in handy for other things as well
(in case anyone wants to embed visually hidden characters for some
reason, either for formatting or something else -- in other words, this
would be a useful feature to have VIM support in general, no ?).

Regards,

 - Nadim


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/