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

less & composing characters - fix



Hi Mark, I'm attaching a patch to 'less-378' which corrects a
problem with regards to composing as well as combining characters. 
Composing characters are characters that are in essence piggy-backed
onto preceding characters and get displayed or super-imposed on them.
Combining characters are similar except they functionally change the
look-n-feel of previous characters and only come into operation if
certain combinations of letters are present.  In other words,
composing/combining characters get folded into characters that
proceeded them and as such 'less' should not account for them as
taking up any room on the line/column.

Here's an example (so that I don't sound like a lunatic :-)  Assume
characters X, Y, Z are composing characters (there are many of them
according to the unicode spec) and I have the following sample of text.


this is a tesXt, a veXYry simpZle test.

 (currently displayed as 39 characters - WRONG)


The X, Y, Z characters will be displayed/super-imposed onto the
characters they proceeded and so you will end-up with something
like this,


this is a teSt, a vEry simPle test.

 (with patch displayed as 35 characters - CORRECT)


Sorry didn't know how else to show it to convey the idea.  So why should
'less' care ?  well 'less' should not count those characters as anything
that takes up room on the line (they should be completely ignored if you
will).  In other words, if I have alot of them in a line, I get
line-wrapping even though there is plenty of room.

I can certainly send you screenshots and actual examples if need be, so
don't hesitate to ask.

BTW: I highly suggest you treat these multi-byte (mbyte) characters as
a single entity (ie. combine their various mutli-byte sequences into
a single encoded array entry) to simplify their treatment (I suggest
that in the code in my comments).

Do please inspect the patch (as it contains a 'hack' with regard to how
the code is currently written) and do please consider including it (or
something similar) at your earliest convenience.  What's noted works for
me without issue.

Regards,

 - Nadim


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Attachment: less_composing.patch.gz
Description: less_composing.patch.gz