Ticket #3262 (closed enhancement: fixed)

Opened 10 years ago

Last modified 9 years ago

Inconsistent "char_width" usage in source

Reported by: egmont Owned by:
Priority: minor Milestone: 4.8.14
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

In the source code, "char_width" or "cw" usually (especially in the viewer and editor) refers to the UTF-8 encoded byte length, while sometimes (e.g. strutilutf8.c str_utf8_term_char_width()) to the number of the character cells occupied in the terminal.

The former usage is incorrect, misleading, makes it harder to read/write source code. It should be search/replaced to byte_length or something similar. The word "width" should always refer to the number of character cells occupied by the Unicode codepoint, never to the number of bytes required to encode it.

Change History

comment:1 Changed 10 years ago by egmont

  • Type changed from defect to enhancement

comment:2 Changed 9 years ago by andrew_b

What about "char_length", the length of character in bytes?

comment:3 follow-up: ↓ 4 Changed 9 years ago by egmont

Sound good. Maybe similary just "cl" where it's "cw" now.

comment:4 in reply to: ↑ 3 Changed 9 years ago by andrew_b

  • Blocked By 3265 added
  • Milestone changed from Future Releases to 4.8.14

Replying to egmont:

Sound good. Maybe similary just "cl" where it's "cw" now.

I renamed "char_width", "cw", "bytes_consumed" to "char_length" for unification.
This commit is in the 3265_cleanup branch.

comment:5 Changed 9 years ago by andrew_b

  • Blocked By 3265 removed

comment:6 Changed 9 years ago by andrew_b

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.