Wrong characters count
- Hello, Bram!
Thursday, January 27, 2005, 10:56:37 PM, you wrote:
>> On the other hand, there is a real need to count displayed characters.BM> I suppose you count a character with its composing characters for one
>> For example: when you have a restriction to write a text not exceeding
>> of, say, 3000 characters (every text, which is prepared for printing
>> have such an restriction). Or you are creating a program description
>> for posting to the software archive: 100-characters description,
>> 400-characters description etc...
BM> then? And how about double-wide characters?
Yes, I was talking about characters, so (IMHO) if the letter is
displayed as one character we should count it as one charater even if
it occupy two spaces... I'm not really working with double-wide
characters, so I may be wrong.
>> So, maybe we need an additional function to return the count ofBM> What would you use the function for? Just for displaying the count?
>> displayed characters? I think the approaches like ':s/./&/g' and
>> 'strlen(substitute(getline("."), ".", "x", "g"))' are not intuitive at
>> all for a novice, who just needs to know how many lines, words and
>> characters are already in his text.
Yes, just for the statistics. We do not need such a function if 'g^G'
will display this info. Personally I'm interested in the following
- columns info (available)
- lines info (available)
- words info (available)
- characters info (instead of or in addition to the bytes info)
Two main characters counts are widely used: counting spaces and not
counting spaces. So, the perfect implementation could look like this:
Col 487-291 of 791-479; Line 5 of 8; Word 121 of 178; Char 1754-1201 of 2517-1913
BM> Hmm, counting all the characters in the Visual area can be quite slow,
BM> since it requires going over the text and doing the counting. We can do
BM> it for a few lines, but not much more. Perhaps we can limit it to the
BM> value of 'lines'.
Ah, yes. You are right: displaying the characters count while
selecting text may slow down the Visual mode. So, I think I should
withdraw this request and limit all my previous requests to these two:
1) Please, extend the info, which is displayed by 'g^G' with the
2) Please, display the count of bytes actually written to the disk
when saving the file (instead of the count of the bytes in memory).
Valery Kondakoff mailto:strauss@...
PGP key: mailto:pgp-public-keys@...?subject=GET%20strauss@...