Talk:RichMemo/WorkArounds

From Free Pascal wiki
Jump to navigationJump to search

Draft

This is a draft, something that should be taken with the proverbial "grain of salt" at least until the RichMemo author has had a chance to comment. Testing was done with an early September 2017 copy of RichMemo, Lazarus 1.8rc4 and a Mac running Sierra.

Draft - method status table

Very early draft, dated October 2020, many tests incomplete here....

Feature Win32 Gtk2 Qt5 Cocoa
GetTextLen ? OK OK Depends on (eg) https://bugs.freepascal.org/view.php?id=37835
GetTextAttributes / SetTextAttributes / SetRangeParams ? OK not doing highlight depends on GetTextLen
GetStyleRange ? OK Broken, returns every char as a range, fix with https://bugs.freepascal.org/view.php?id=37894 depends on GetTextLen
SetRangeParams ? OK OK except background colour
GetParaRange ? OK Broken, workaround below. Broken, workaround below.
Search OK broken broken
SetLink OK broken broken
GetParaMetric OK broken depends on GetParaRange
SetParaMetric OK broken depends on GetParaRange
GetParaNumbering Broken
SetParaNumbering

Status of Functions on the Mac

By Cocoa, we mean the 64bit Cocoa widget set, Lazarus Fixes and RichMemo Trunk. Less is working on the RichMemo Stable.

Method Cocoa
SetTextAttributes() OK
GetTextAttributes(..) broken as of Feb 2020 it calls GettextLen which is broken, see main page for fix
SetRangeParams(..) OK
GetStyleRange(..) OK
GetParaMetric(..) Fail ?
SetParaMetric(..) Fail
GetParaRange(..) Fail
SetRangeParaParams(..) Fail Depends on GetParaRange()
Search() Fail Might be able to use FindText() or search RichMemo1.Text
GetTextLen(..) Fail Not official RichMemo function, higher up ...
SetLink() Fail Actually works but the linked text is not displayed in blue or underlined etc
Font Background Color OK As noted on RichMemo page
OnChange Event Fail Event does not fire under Cocoa ?

Notes

  • GetParaMetric() on Cocoa always returns True and says indent is 0. Its not possible to set an indent of more than zero so hard to know if its working or not. Follow the code David....
  • SetParaMetric() on Cocoa makes no visible change to text. On Cocoa it calls TCocoaWSCustomRichMemo.SetParaMetric(..) which includes a line "txt:=view.textStorage" that seems to cause a silent and local crash (my words). The method is terminated prematurely dropping back to the RichMemo function and nothing is done to the text. This premature termination confuses gdb, crashing it with a message cannot find bounds of function.
  • Search() always returns false on Cocoa but does not set vars at all.
  • For GetTextAttributes(), on Cocoa fails because GetTextLen() does not work. I think something like UYF8length(Text) seems to work, possibly slow. Wonder how much faster UTF8LengthFast() is ?
  • GetStyleRange() is a problem elsewhere too, I have a local function to do that.
  • I have a local SetRangeParams() working, might be slow, will appear when I've tested it a bit more....