TextView.st
changeset 2109 ccad6daad477
parent 2100 69c10efca8f4
child 2118 f9d8bfb35b03
equal deleted inserted replaced
2108:b9322a905330 2109:ccad6daad477
   428 
   428 
   429 selectionStopIndex
   429 selectionStopIndex
   430     "ST-80 compatibility: return the character position of
   430     "ST-80 compatibility: return the character position of
   431      the character right after the selection."
   431      the character right after the selection."
   432 
   432 
   433     ^ self characterPositionOfSelectionEnd + 1
   433     |idx|
       
   434 
       
   435     idx := self characterPositionOfSelectionEnd.
       
   436     idx == 0 ifTrue:[^ 0].
       
   437     ^ idx + 1
   434 
   438 
   435     "Created: / 19.6.1998 / 00:22:08 / cg"
   439     "Created: / 19.6.1998 / 00:22:08 / cg"
   436 ! !
   440 ! !
   437 
   441 
   438 !TextView methodsFor:'accessing'!
   442 !TextView methodsFor:'accessing'!
   452     "return the character index of the last character in the selection.
   456     "return the character index of the last character in the selection.
   453      Returns 0 if there is no selection."
   457      Returns 0 if there is no selection."
   454 
   458 
   455     selectionStartLine isNil ifTrue:[^ 0].
   459     selectionStartLine isNil ifTrue:[^ 0].
   456     ^ self characterPositionOfLine:selectionEndLine
   460     ^ self characterPositionOfLine:selectionEndLine
   457 			       col:selectionEndCol
   461                                col:selectionEndCol
   458 
   462 
   459     "Created: 14.8.1997 / 16:35:24 / cg"
   463     "Created: 14.8.1997 / 16:35:24 / cg"
   460     "Modified: 14.8.1997 / 16:35:45 / cg"
   464     "Modified: 14.8.1997 / 16:35:45 / cg"
   461 !
   465 !
   462 
   466 
  1418     "
  1422     "
  1419      Q: should we preserve the last searchstring between views ?
  1423      Q: should we preserve the last searchstring between views ?
  1420     "
  1424     "
  1421 
  1425 
  1422     |searchBox patternField stringHolder caseHolder 
  1426     |searchBox patternField stringHolder caseHolder 
  1423      b bPrev bNext pattern fwd ign|
  1427      b bPrev bNext pattern fwd ign initialString|
  1424 
  1428 
  1425     ign := lastSearchIgnoredCase ? false.
  1429     ign := lastSearchIgnoredCase ? false.
  1426 
  1430 
  1427     searchBox := Dialog new.
  1431     searchBox := Dialog new.
  1428     searchBox label:'string search'.
  1432     searchBox label:'string search'.
  1451     bPrev cursor:(bNext cursor).
  1455     bPrev cursor:(bNext cursor).
  1452 
  1456 
  1453 "/    searchBox addButton:(Button label:(resources at:'all'));
  1457 "/    searchBox addButton:(Button label:(resources at:'all'));
  1454 
  1458 
  1455     lastSearchPattern notNil ifTrue:[
  1459     lastSearchPattern notNil ifTrue:[
  1456         stringHolder value:lastSearchPattern
  1460         initialString := lastSearchPattern
  1457     ].
  1461     ].
  1458     self hasSelection ifTrue:[
  1462     self hasSelection ifTrue:[
  1459         selectionStartLine == selectionEndLine ifTrue:[
  1463         selectionStartLine == selectionEndLine ifTrue:[
  1460             stringHolder value:self selection
  1464             initialString := self selection
  1461         ]
  1465         ]
       
  1466     ].
       
  1467     initialString isNil ifTrue:[
       
  1468         LastSearchPatterns size > 0 ifTrue:[
       
  1469             initialString := LastSearchPatterns first
       
  1470         ]
       
  1471     ].
       
  1472 
       
  1473     initialString notNil ifTrue:[
       
  1474         stringHolder value:initialString.
  1462     ].
  1475     ].
  1463     patternField selectAll.
  1476     patternField selectAll.
  1464 
  1477 
  1465     fwd := true.
  1478     fwd := true.
  1466     searchBox open.
  1479     searchBox open.
  2975 ! !
  2988 ! !
  2976 
  2989 
  2977 !TextView class methodsFor:'documentation'!
  2990 !TextView class methodsFor:'documentation'!
  2978 
  2991 
  2979 version
  2992 version
  2980     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.148 2000-01-17 11:18:33 cg Exp $'
  2993     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.149 2000-01-31 18:58:49 cg Exp $'
  2981 ! !
  2994 ! !