Opened 7 years ago
Closed 5 years ago
#3633 closed Bug (Fixed)
_GUICtrlRichEdit_FindText does not flag failure to find CR
Reported by: | davidjudysmith@… | Owned by: | Jpm |
---|---|---|---|
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)
Change History (3)
Changed 7 years ago by davidjudysmith@…
comment:1 Changed 5 years ago by Jon
- Component changed from AutoIt to Standard UDFs
comment:2 Changed 5 years ago by Jpm
- Milestone set to 3.3.15.4
- Owner set to Jpm
- Resolution set to Fixed
- Status changed from new to closed
Fixed by revision [12330] in version: 3.3.15.4
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Test script, showing that _FindText doesn't report failure