Alexey-T / CudaText

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

For long CJK lines (len>1024), CJK chars are rendered overlapped #5549

Closed zangloo closed 2 weeks ago

zangloo commented 2 weeks ago

If wrapped, it render correctly.

Version: CudaText 1.214.7.2, linux-x86_64-gtk2, fpc 3.2.3 Steps:

  1. open a new tab
  2. paste the text
      死去憑誰報,歸來始自憐。猶瞻太白雪,喜遇武功天。影靜千官<small about="#mwt56" typeof="mw:Transclusion">一作門</small>裏,心蘇七校前。今朝漢社稷,新數<small about="#mwt57" typeof="mw:Transclusion">所主切</small>中<small about="#mwt58" typeof="mw:Transclusion">張仲切</small>興年。<br/><small about="#mwt59" typeof="mw:Transclusion">此承上「暫時人」,故接以「死去憑誰報」。 瞻雪遇天,幸依行在矣。千官七校,親覩朝班矣。新數中興,從此治安矣。皆寫出破愁為喜。 趙汸注:脱一生於萬死,在道時猶不覺,及歸乃自憐耳,起語悲痛。奔波初定,故曰影靜。精神頓爽,有似心蘇。官指文臣,校乃武衛。<br/> 陶潛詩:死去何所道。 報,報信也。<br/> 陶詩:歸來夜未央。 顧注:前曰生還,此曰歸來,總以君之所在為歸耳。 魏文帝詩:私自憐兮孤棲。<br/> <span class="book-name">地圖記</span>:太白山甚高,上常積雪,無草木。<span class="book-name">辛氏三秦記</span>:太白山,在武功縣南,去長安三百里。<span class="book-name">錄異記</span>:金星之精,墜於終南,號為太白,其精化為白石,狀如美玉,常有紫氣覆之。<span class="book-name">唐書</span>:鳳翔府郿縣有太白山。<br/> <span class="book-name">長安志</span>:京兆武功縣,以武功山得名。<span class="book-name">三秦記</span>:武功太白,去天三百。曰武功天,至此得見天日也。<br/> <span class="book-name">荀子</span>:古者天子千官。<span class="book-name">漢書·嚴助傳</span>:奉千官之供。<br/>蘇,蘇醒也。 <span class="book-name">漢書</span>:京師有南北軍屯,至武帝平百越,内增七校。 注:中壘、屯騎、步兵、越騎、長水、胡騎、射聲、虎賁,凡八校尉。胡騎不常置,故言七校。<br/> <span class="book-name">詩</span>:以永今朝。<br/> <span class="book-name">東皋雜錄</span>:毛公<span class="book-name">詩序</span>:<span class="book-name">蒸民</span>,任賢使能,使周室中興焉。陸德明<span class="book-name">釋文</span>讀去聲。故杜云「新數中興年」,又「百年垂死中興時」。</small><br/>

The user.json as below: { "ui_theme": "syn", "ui_theme_syntax": "syn", "ui_tab_show_x": 0, "mouse_drag_drop": false, "font_name__linux": "Noto Sans Mono CJK SC", "font_size__linux": 20, "ui_font_size__linux": 15, "numbers_show": false, "ui_sidebar_show": false, "ui_tab_switcher_dialog": true, "smooth_scroll": false, "wrap_indented": false, } Screenshot_2024-06-13_12-14-28

Alexey-T commented 2 weeks ago

For lines (not wrapped) bigger than N (N=1024 chars) any chars are rendered in normal-width cells (100%), so CJK chars (190%) overlap by design.

Alexey-T commented 2 weeks ago

To change this in src: file atsynedit/atstringproc.pas change this

const
  //if line is longer - all line chars will be rendered in normal-width (100%) cells
  //so all CJK chars (width 190%) will overlap by design
  cMaxFixedArray = 1024;
zangloo commented 2 weeks ago

Or maybe add an option to override this default value?

Alexey-T commented 2 weeks ago

Cannot add the option, because that constant must be fixed at compile time, it limits the array len.

zangloo commented 2 weeks ago

Ok, i see.