Fossil

Check-in [2a5de7ea]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the ability to search by NoCase, RegExp, or WholeWord.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:2a5de7ea2e119a66b92cc6103325a8285eb4d09b
User & Date: drh 2016-07-29 21:40:16
Context
2016-08-01
11:01
Minor UI enhancements in the --tk diff display. check-in: 3d746845 user: drh tags: trunk
2016-07-29
21:40
Add the ability to search by NoCase, RegExp, or WholeWord. check-in: 2a5de7ea user: drh tags: trunk
21:27
Add a simple "Search" button to the --tk diff widget. check-in: cea60811 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diff.tcl.

387
388
389
390
391
392
393




394
395
396
397
398
399
400
401
402
403
404
405
406






407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
      frame .bb.sframe
      ::ttk::entry .bb.sframe.e -width 10
      pack .bb.sframe.e -side left -fill y -expand 1
      ::ttk::button .bb.sframe.nx -text \u2193 -width 1 \
          -command {searchNext -forwards +1 1.0 end}
      ::ttk::button .bb.sframe.pv -text \u2191 -width 1 \
          -command {searchNext -backwards -1 end 1.0}




      pack .bb.sframe.nx .bb.sframe.pv -side left
    }
    pack .bb.sframe -side left
  }
}
proc searchNext {direction incr start stop} {
  set pattern [.bb.sframe.e get]
  set count 0
  set w $::search
  if {"$w"==".txtA"} {set other .txtB} {set other .txtA}
  if {[lsearch [$w mark names] search]<0} {
    $w mark set search $start
  }






  set idx [$w search -count count $direction -- \
              $pattern "search $incr chars" $stop]
  if {"$idx"==""} {
    set this $w
    set w $other
    set other $this
    set idx [$w search -count count $direction -- $pattern $start $stop]
    if {"$idx"==""} {
      set this $w
      set w $other
      set other $this
      set idx [$w search -count count $direction -- $pattern $start $stop]
    }
  }
  $w tag remove search 1.0 end
  $w mark unset search
  $other tag remove search 1.0 end
  $other mark unset search
  if {"$idx"!=""} {







>
>
>
>
|












>
>
>
>
>
>
|





|




|







387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
      frame .bb.sframe
      ::ttk::entry .bb.sframe.e -width 10
      pack .bb.sframe.e -side left -fill y -expand 1
      ::ttk::button .bb.sframe.nx -text \u2193 -width 1 \
          -command {searchNext -forwards +1 1.0 end}
      ::ttk::button .bb.sframe.pv -text \u2191 -width 1 \
          -command {searchNext -backwards -1 end 1.0}
      tk_optionMenu .bb.sframe.typ ::search_type \
           Exact {No Case} {RegExp} {Whole Word}
      .bb.sframe.typ config -width 10
      set ::search_type Exact
      pack .bb.sframe.nx .bb.sframe.pv .bb.sframe.typ -side left
    }
    pack .bb.sframe -side left
  }
}
proc searchNext {direction incr start stop} {
  set pattern [.bb.sframe.e get]
  set count 0
  set w $::search
  if {"$w"==".txtA"} {set other .txtB} {set other .txtA}
  if {[lsearch [$w mark names] search]<0} {
    $w mark set search $start
  }
  switch $::search_type {
    Exact        {set st -exact}
    {No Case}    {set st -nocase}
    {RegExp}     {set st -regexp}
    {Whole Word} {set st -regexp; set pattern \\y$pattern\\y}
  }
  set idx [$w search -count count $direction $st -- \
              $pattern "search $incr chars" $stop]
  if {"$idx"==""} {
    set this $w
    set w $other
    set other $this
    set idx [$w search -count count $direction $st -- $pattern $start $stop]
    if {"$idx"==""} {
      set this $w
      set w $other
      set other $this
      set idx [$w search -count count $direction $st -- $pattern $start $stop]
    }
  }
  $w tag remove search 1.0 end
  $w mark unset search
  $other tag remove search 1.0 end
  $other mark unset search
  if {"$idx"!=""} {