You have the argument '-forwards'. The possible options are documented as '-forward' and '-reverse'.my $result = $t->FindNext(-forwards, -exact, -nocase, "the"); # /^\
Note that Tk/Text.pm actually uses the following code:
So effectively anything not '-forward' is treated as '-reverse'.eval { if ($direction eq '-forward') { $w->markSet('insert', 'sel.last'); $w->markSet('current', 'sel.last'); } else { $w->markSet('insert', 'sel.first'); $w->markSet('current', 'sel.first'); } };
Update - I should have looked further.
After the bit of code I copied above, FindNext calls the Text's search method with $direction as the first parameter. The search method is documented as using '-forwards' or '-backwards'. The C source at tkText.c agrees: the TextSearchCmd function does not mention '-reverse'.
The relevant C is:
Because of the use of strncmp with 'length', either '-forward' or '-forwards' will work correctly in the call to search.arg = argv[i]; ... length = strlen(arg); ... c = arg[1]; if ((c == 'b') && (strncmp(argv[i], "-backwards", length) == 0)) { backwards = 1; ... } else if ((c == 'f') && (strncmp(argv[i], "-forwards", length) == 0)) + { backwards = 0;
Final answer: in FindNext use '-forward', '-backward', or '-backwards'. Do not use '-reverse' as documented, or '-forwards' like search.
When using search, '-forward', '-forwards', '-backward', or '-backwards' are all acceptable.
Update2: bug report forwarded to slaven@rezic.de. Tk::Text bug report
Update 2010-02-02: Patches in the Perl/Tk subversion repo as r13796.
In reply to Re: Why Findnext does not works?
by keszler
in thread Why Findnext does not works?
by balee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |