Posted to tcl by schelte at Mon Mar 11 19:09:50 GMT 2013view raw

  1. proc searchnext w {
  2. global Find opt
  3.  
  4. reorder .f.sr.f
  5. $w tag remove hilite 1.0 end
  6. set options {}
  7. if {$opt(direction) ne "backward"} {
  8. lappend options -forward
  9. set start insert+1c
  10. } else {
  11. lappend options -backward
  12. set start insert
  13. }
  14. if {!$opt(matchcase)} {
  15. lappend options -nocase
  16. }
  17. set pos [$w search {*}$options -count n -- $Find $start]
  18. if {$pos ne ""} {
  19. $w mark set insert $pos
  20. $w see insert
  21. $w tag add hilite $pos $pos+${n}c
  22. }
  23. }