Modify

Opened 8 years ago

Closed 6 years ago

#3633 closed Bug (Fixed)

_GUICtrlRichEdit_FindText does not flag failure to find CR

Reported by: davidjudysmith@… Owned by: J-Paul Mesnage
Milestone: 3.3.15.4 Component: Standard UDFs
Version: 3.3.14.0 Severity: None
Keywords: Rich Edit, FindText, Carriage return Cc:

Description

There seems to be a problem with _GUICtrlRichEdit_FindText, or at least a problem with its documentation.

The attached script FindTextTest.au3 illustrates the problem. The script creates a Rich Edit control and fills it with three lines, one of which is blank; each line is followed by a CR. The For loop sets the character position, initially at the beginning of the text, then searches for the next CR character. Results of these searches are reported in a MsgBox when the loop completes.

According to the documentation, _GUICtrlRichEdit_FindText should return "the inter-character position before start of matching text if found, else -1." But my test program never gets a -1 from that function, even when it is obviously searching beyond the end of the text.

The third pass through the For loop correctly returns the position of the last CR. The fourth pass should return a -1 status or a code in @error, because there are no more CR characters, but it does not. In the last two passes, the FindText function returns a value that is one less than the starting position, apparently because the starting position is beyond the end of the text, but that behavior is not documented. (Note that GotoCharPos does not fail.) The error only comes from GetTextInRange, because End<Start.

I suggest one or more of the following:

  • Return a failure from GotoCharPos if the position is beyond the end of the text;
  • Correctly handle searches for CR characters, which seem to be different from printable characters;
  • Provide a different way to search for CR characters (actual end of a line/paragraph, not just end of displayed line);
  • Document that FindText returns the position of the end of the text, if it is started beyond that point, or generate an error in that case.

Note also that _GUICtrlRichEdit_GetTextLength returns a number that's larger (25 vs 22) than the actual number of characters. That makes it useless for a comparison with character positions.

Attachments (1)

FindTextTest.au3 (1.6 KB ) - added by davidjudysmith@… 8 years ago.
Test script, showing that _FindText doesn't report failure

Download all attachments as: .zip

Change History (3)

by davidjudysmith@…, 8 years ago

Attachment: FindTextTest.au3 added

Test script, showing that _FindText doesn't report failure

comment:1 by Jon, 6 years ago

Component: AutoItStandard UDFs

comment:2 by J-Paul Mesnage, 6 years ago

Milestone: 3.3.15.4
Owner: set to J-Paul Mesnage
Resolution: Fixed
Status: newclosed

Fixed by revision [12330] in version: 3.3.15.4

Modify Ticket

Action
as closed The owner will remain J-Paul Mesnage.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.