TextView.st
changeset 5716 f2d5d5d5d4d6
parent 5714 7da163a68f57
child 5726 04a5c547c98f
child 5737 98bc0782ffa1
equal deleted inserted replaced
5715:8baebc416a38 5716:f2d5d5d5d4d6
  3645     pos :=  self startPositionForSearchBackward.
  3645     pos :=  self startPositionForSearchBackward.
  3646     startLine := pos y.
  3646     startLine := pos y.
  3647     startCol := pos x.
  3647     startCol := pos x.
  3648 
  3648 
  3649     self
  3649     self
  3650 	searchBackwardUsingSpec:searchSpec
  3650         searchBackwardUsingSpec:searchSpec
  3651 	startingAtLine:startLine col:startCol
  3651         startingAtLine:startLine col:startCol
  3652 	ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col]
  3652         ifFound:[:line :col :endColOrNil| 
  3653 	ifAbsent:aBlock
  3653             self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
       
  3654         ]
       
  3655         ifAbsent:aBlock
  3654 !
  3656 !
  3655 
  3657 
  3656 searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
  3658 searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
  3657     "select characters enclosed by matching parenthesis if one is under startLine/Col"
  3659     "select characters enclosed by matching parenthesis if one is under startLine/Col"
  3658 
  3660 
  4388     "do a forward search"
  4390     "do a forward search"
  4389 
  4391 
  4390     self
  4392     self
  4391         searchForwardUsingSpec:searchSpec
  4393         searchForwardUsingSpec:searchSpec
  4392         startingAtLine:startLine col:startCol
  4394         startingAtLine:startLine col:startCol
  4393         ifFound:[:line :col | 
  4395         ifFound:[:line :col :endColOrNil| 
  4394             self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col
  4396             self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col endCol:endColOrNil
  4395         ]
  4397         ]
  4396         ifAbsent:aBlock
  4398         ifAbsent:aBlock
  4397 !
  4399 !
  4398 
  4400 
  4399 searchPattern
  4401 searchPattern
  4491 
  4493 
  4492     "Modified: / 6.3.1999 / 23:48:04 / cg"
  4494     "Modified: / 6.3.1999 / 23:48:04 / cg"
  4493 !
  4495 !
  4494 
  4496 
  4495 showMatch:pattern atLine:line col:col
  4497 showMatch:pattern atLine:line col:col
       
  4498     <resource: #obsolete>
  4496     "after a search, highlight the matched pattern.
  4499     "after a search, highlight the matched pattern.
  4497      The code below needs a rewrite to take care of match-characters
  4500      The code below needs a rewrite to take care of match-characters
  4498      (for now, it only highlights simple patterns and '*string*' correctly)"
  4501      (for now, it only highlights simple patterns and '*string*' correctly)"
  4499 
  4502 
  4500     self showMatch:pattern isMatch:true atLine:line col:col
  4503     self showMatch:pattern isMatch:true atLine:line col:col endCol:nil
  4501 !
  4504 !
  4502 
  4505 
  4503 showMatch:pattern isMatch:isMatch atLine:line col:col
  4506 showMatch:pattern isMatch:isMatch atLine:line col:col
       
  4507     <resource: #obsolete>
       
  4508     "after a search, highlight the matched pattern."
       
  4509 
       
  4510     self showMatch:pattern isMatch:isMatch atLine:line col:col endCol:nil
       
  4511 !
       
  4512 
       
  4513 showMatch:pattern isMatch:isMatch atLine:line col:col endCol:encColOrNil
  4504     "after a search, highlight the matched pattern.
  4514     "after a search, highlight the matched pattern.
  4505      The code below needs a rewrite to take care of match-characters
  4515      The code below needs a rewrite to take care of match-characters
  4506      (for now, it only highlights simple patterns and '*string*' correctly)"
  4516      (for now, it only highlights simple patterns and '*string*' correctly)"
  4507 
  4517 
  4508     |realPattern|
  4518     |endCol realPattern|
  4509 
  4519 
  4510     realPattern := pattern.
  4520     (endCol := encColOrNil) isNil ifTrue:[
  4511 
  4521         "/ a hack.
  4512     isMatch ifTrue: [
  4522         realPattern := pattern.
  4513         (realPattern startsWith:$*) ifTrue:[
  4523         isMatch ifTrue: [
  4514             realPattern := realPattern copyButFirst
  4524             (realPattern startsWith:$*) ifTrue:[
       
  4525                 realPattern := realPattern copyButFirst
       
  4526             ].
       
  4527             (realPattern endsWith:$*) ifTrue:[
       
  4528                 realPattern := realPattern copyButLast
       
  4529             ].
  4515         ].
  4530         ].
  4516         (realPattern endsWith:$*) ifTrue:[
  4531         endCol := (col + realPattern size - 1).
  4517             realPattern := realPattern copyButLast
  4532     ].
  4518         ].
  4533 
  4519     ].
  4534     self selectFromLine:line col:col toLine:line col:endCol.
  4520 
       
  4521     self selectFromLine:line col:col
       
  4522                  toLine:line col:(col + realPattern size - 1).
       
  4523     self makeLineVisible:line
  4535     self makeLineVisible:line
  4524 !
  4536 !
  4525 
  4537 
  4526 showNotFound
  4538 showNotFound
  4527     "search not found - tell user by beeping and changing
  4539     "search not found - tell user by beeping and changing