Loading ...
Sorry, an error occurred while loading the content.

Wrong characters count

Expand Messages
  • Valery Kondakoff
    Hello, Bram! ... BM I suppose you count a character with its composing characters for one BM then? And how about double-wide characters? Yes, I was talking
    Message 1 of 8 , Jan 28, 2005
    • 0 Attachment
      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.
      >> 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> I suppose you count a character with its composing characters for one
      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 of
      >> 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.
      BM> What would you use the function for? Just for displaying the count?

      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
      statistics:

      - 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
      characters count.
      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).

      Thank you.

      --
      Best regards,
      Valery Kondakoff mailto:strauss@...

      PGP key: mailto:pgp-public-keys@...?subject=GET%20strauss@...
    Your message has been successfully submitted and would be delivered to recipients shortly.