Recent

Author Topic: Error only if Synedit is opened in second editor  (Read 3427 times)

Borneq

  • Full Member
  • ***
  • Posts: 248
Error only if Synedit is opened in second editor
« on: December 27, 2019, 12:31:47 pm »
I have two files (one can be copy of second). This fule must contain both Unicode and Tabs. If I open first tab is Ok, but only next tabs are bad - instead unicode is "?". This is only when Synedit changed to using wordWrap. How locate this error? Any structures must be global ? - how Synedit can distinguish instances?

Borneq

  • Full Member
  • ***
  • Posts: 248
Re: Error only if Synedit is opened in second editor
« Reply #1 on: December 27, 2019, 01:28:49 pm »
I noticed:
1. Error is also in first, If window width is modified
2. No error if don't use TSynEditStringTabExpander.ExpandedString

Error is in TSynEditStringTabExpander.ExpandedString which I modified.
This method is needed? If I type:
Code: Pascal  [Select][+][-]
  1. function TSynEditStringTabExpander.ExpandedString(Index: integer): string;
  2. var
  3.   Line: String;
  4.   CharWidths: TPhysicalCharWidths;
  5.   i, j, l, ll: Integer;
  6. begin
  7.   Result := fSynStrings[Index];
  8.   exit;  
Is is OK.

Temporary I disabled this method in my editor.
Maybe instead of GetPhysicalCharWidths should be line converted to UTF32 ? Especially, is needed method giving unicode32 code point for cursor position.
« Last Edit: December 27, 2019, 01:50:36 pm by Borneq »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9855
  • Debugger - SynEdit - and more
    • wiki
Re: Error only if Synedit is opened in second editor
« Reply #2 on: December 27, 2019, 01:59:46 pm »
Even utf32 has combining codepoints.

But GetPhysicalCharWidths  strings is not about multibyte encoding. It is about the width of some glyphs (full width chars). https://forum.lazarus.freepascal.org/index.php/topic,47747.msg342553.html#msg342553


Maybe the wrap code does something that changes text, without clearing the GetPhysicalCharWidths   cache ( IIRC there is a cache, but needs to be double checked)
« Last Edit: December 27, 2019, 02:01:41 pm by Martin_fr »

Borneq

  • Full Member
  • ***
  • Posts: 248
Re: Error only if Synedit is opened in second editor
« Reply #3 on: December 30, 2019, 10:13:43 pm »
I think, error is whenever is running this method changed by me. (Before was error with binary files), this method is calling when:
- second editor is called
- or simply is modified wirth of SynEdit components
Must be :
- tabs
- Unicode
Probably not must be WordWrap to cause this error.

 

TinyPortal © 2005-2018