Hi,

James Vega wrote:
>
> On Wed, Jul 05, 2006 at 11:50:51AM +0200, Jürgen Krämer wrote:
>>
>> with 'encoding' set to "utf-8" there is a quite confusing (to me)
>> difference between the column number and my expectations (supported by
>> the virtual column number) if there are non-ASCII characters on the
>> line.
>
> Column number n is really the nth byte on that line.  This is described
> at ":help /\%c".  This description should explain all the behavior
> you're seeing.  This is the intended behavior and I'm not sure of a way
> off-hand to get the visual character count like you want.

yes, it does *explain* the behaviour. But it makes things even worse.
Suppose I have some lines with aligned data (just like a table) where I
want to replace certain columns with dashes, e.g.,

  Peter    Traurig irgendwo  0
  Hänschen Klein   unterwegs 1
  Jürgen   Krämer  hier      2

  :%s/\%18c.*\%27c/---------/

should strike out the third column of the table, but the result is

  Peter    Traurig --------- 0
  Hänschen Klein  ---------s 1
  Jürgen   Krämer---------   2

which is depending on the random number of non-ASCII characters in front
of the used position, characters whose internal representations should
never be relevant for this substitution, because the user cannot know
them.

Since it works as documented it is hard to call it a bug, but I would
really consider it a mis-feature, because it works in such a
non-predictable way.

To work around the problem in this example is not that hard -- I can use
/\%...v instead. The example in my original mail poses a bigger problem
(to me) -- I'd like to switch to "encoding=utf-8" as default, but I
often need to work with text files of fixed line length. With encoding
set to "latin1" the difference between column number and virtual column
number in the status line is a visual clue that there is a tabular or a
control code in the line, reminding me to look for this character. With
UTF-8 encoding this hint would be rendered useless because of all those
little umlauts in German. :-(

But perhaps this is just my special problem.

Regards,
Jürgen


-- 
Jürgen Krämer                              Softwareentwicklung
HABEL GmbH & Co. KG                        mailto:[EMAIL PROTECTED]
Hinteres Öschle 2                          Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-Weilheim                    Fax: +49 / 74 61 / 93 53 - 99

Reply via email to