Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.51k stars 173 forks source link

character width issue #2585

Closed akizuha closed 4 years ago

akizuha commented 4 years ago

CudaText 1.100 1 2

Lazarus (synedit) 3

  1. when a line becomes too long (>= 501 Chinese character exactly), full width characters will be compressed to half width. (pic 1)
  2. because of 1, normal selecting of compressed characters is deviantly. (pic 2)
  3. vertical selecting mixed width character is not aligned. (pic 1) which Lazarus can (pic 3)
Alexey-T commented 4 years ago
  1. can be solved by new option - max_line_len_for_accurate_width

2/3. it is documented (i cannot find where) - column block always makes selection from the same col-1..col-2 on all lines. picture may look weird with it.

akizuha commented 4 years ago

Why need a "max_line_len_for_accurate_width" other than unlimited accurate width length?

2/3 Maybe count full width characters as 2 cols?

a ↑THIS is really strange.

Alexey-T commented 4 years ago

Option is needed- on renreding LONG Unicode lines, rendering is too slow.

Picture. you started at column 7 (line 1) and ended at column 20 (line 6). picture is weird. but text block is columns 7 to 20.

Alexey-T commented 4 years ago

added this to Wiki, https://wiki.freepascal.org/CudaText#Why_column_selection_looks_weird_with_CJK_characters

akizuha commented 4 years ago

aa

Long line rendering can be FAST, even with word wrap.

Alexey-T commented 4 years ago

maybe. current ATSynEdit code calcs TextWidth for all chars in a line. so max len=500 makes sense

Alexey-T commented 4 years ago

maybe EmEditor calcs CharWidth fast. w/o calling Win32 API. not sure.

akizuha commented 4 years ago

IIRC LCL has built-in platform independent freetype support. Also, why not just calculate two width: one for half-width character, one for full-wdith. (Assume nobody use proportional fonts in such editor?)

aa this is awkward

Alexey-T commented 4 years ago

Made a fix, detect now char-width by char 'N' (was used wide char 'M'- it gave too wide cells for Colibri)

Alexey-T commented 4 years ago

full-width size: engine already uses some fixed width - "unicode_full_width":190 but problem is another one, sometimes code needs that "limit" of 500 chars.

Alexey-T commented 4 years ago

IIRC code needs the "limit" to optimize caret jumps over HUGE (len=4M) lines