View Issue Details

IDProjectCategoryView StatusLast Update
0032296Lazarus CCRPackagespublic2020-01-13 16:09
ReporterDavidAssigned ToDmitry Boyarintsev 
Status resolvedResolutionfixed 
PlatformWindowsOSOS Version10
Summary0032296: RichMemo.GetTextAttributes() does not return false when first param out of range
DescriptionFirst Param to this function points to a char in the Memo that it should report on. The function is described as returning False if the indicated char is somehow invalid. Passing -1 or a number greater than RichMemo.GetTexLen() however returns True.
Works fin under Linux.
Steps To Reproduce
if Richmemo1.GetTextAttributes(-1, FP) then showmessage('Failed on -1');
if Richmemo1.GetTextAttributes(30000, FP) then showmessage('Failed on 30000');
Additional InformationAn easy fix appears to add a test at entry into the function, insert into line 677 of RichMemo.pas -

677 Result := False;
678 if (textStart < 0) or (TextStart >= GetTextLen) then exit();

Its unnecessary under linux but does no harm. I have tested under Win10 and GTK2 based Linux.
TagsNo tags attached.
Attached Files



2017-09-16 10:29

reporter   ~0102866

This approach does not work on Cocoa because GetTextLen is also not working there. So, it becomes length(Lines.Text) unless GetTextLen is fixed first. I wish ....

Dmitry Boyarintsev

2020-01-13 16:09

developer   ~0120406

please test and close if ok

Issue History

Date Modified Username Field Change
2017-08-19 12:41 David New Issue
2017-08-19 15:08 Bart Broersma Project Packages => Lazarus CCR
2017-09-16 10:29 David Note Added: 0102866
2019-01-29 19:56 Dmitry Boyarintsev Status new => assigned
2019-01-29 19:56 Dmitry Boyarintsev Assigned To => Dmitry Boyarintsev
2020-01-13 16:09 Dmitry Boyarintsev Status assigned => resolved
2020-01-13 16:09 Dmitry Boyarintsev Resolution open => fixed
2020-01-13 16:09 Dmitry Boyarintsev Widgetset Win32/Win64 => Win32/Win64
2020-01-13 16:09 Dmitry Boyarintsev Note Added: 0120406