EditTextView.st
changeset 4666 81e48e442abe
parent 4664 f09d5587253f
child 4673 575d2d398823
equal deleted inserted replaced
4665:138716ae0e55 4666:81e48e442abe
  3463 
  3463 
  3464 replaceSelectionBy:something
  3464 replaceSelectionBy:something
  3465     "delete the selection (if any) and insert something, a character or string;
  3465     "delete the selection (if any) and insert something, a character or string;
  3466      leave cursor after insertion"
  3466      leave cursor after insertion"
  3467 
  3467 
  3468     self replaceSelectionBy:something keepCursor:false
  3468     self replaceSelectionBy:something keepCursor:false select:false
  3469 !
  3469 !
  3470 
  3470 
  3471 replaceSelectionBy:something keepCursor:keep
  3471 replaceSelectionBy:something keepCursor:keep
  3472     "delete the selection (if any) and insert something, a character or string;
  3472     "delete the selection (if any) and insert something, a character or string;
  3473      leave cursor after insertion or leave it, depending on keep"
  3473      leave cursor after insertion or leave it, depending on keep"
  3474 
  3474 
  3475     |sel l c |
  3475     self replaceSelectionBy:something keepCursor:keep select:false
       
  3476 
       
  3477     "Modified: 9.10.1996 / 16:14:35 / cg"
       
  3478 !
       
  3479 
       
  3480 replaceSelectionBy:something keepCursor:keep select:selectNewText
       
  3481     "delete the selection (if any) and insert something, a character or string;
       
  3482      leave cursor after insertion or leave it, depending on keep.
       
  3483      If selectNewText is true, select the new text; otherwise deselect"
       
  3484 
       
  3485     |sel l c selStartLine selStartCol|
  3476 
  3486 
  3477     l := cursorLine.
  3487     l := cursorLine.
  3478     c := cursorCol.
  3488     c := cursorCol.
  3479 
  3489 
  3480     sel := self selection.
  3490     sel := self selection.
  3481     sel notNil ifTrue:[
  3491     sel isNil ifTrue:[
       
  3492         selStartLine := l.
       
  3493         selStartCol := c.
       
  3494     ] ifFalse:[
       
  3495         selStartLine := selectionStartLine.
       
  3496         selStartCol := selectionStartCol.
       
  3497 
  3482         self setLastStringToReplace: sel.
  3498         self setLastStringToReplace: sel.
  3483 
  3499 
  3484         self deleteSelection.
  3500         self deleteSelection.
  3485         replacing := true.
  3501         replacing := true.
  3486         lastReplacementInfo lastReplacement: ''.
  3502         lastReplacementInfo lastReplacement: ''.
  3515             Transcript showCR:'EditTextView: non String-or-Character in replace'.
  3531             Transcript showCR:'EditTextView: non String-or-Character in replace'.
  3516         ].
  3532         ].
  3517     ].
  3533     ].
  3518     keep ifTrue:[
  3534     keep ifTrue:[
  3519         self cursorLine:l col:c
  3535         self cursorLine:l col:c
       
  3536     ].
       
  3537     selectNewText ifTrue:[
       
  3538         self selectFromLine:selStartLine col:selStartCol toLine:cursorLine col:cursorCol-1
  3520     ]
  3539     ]
  3521 
  3540 
  3522     "Modified: 9.10.1996 / 16:14:35 / cg"
  3541     "Modified: 9.10.1996 / 16:14:35 / cg"
  3523 !
  3542 !
  3524 
  3543 
  8195 ! !
  8214 ! !
  8196 
  8215 
  8197 !EditTextView class methodsFor:'documentation'!
  8216 !EditTextView class methodsFor:'documentation'!
  8198 
  8217 
  8199 version
  8218 version
  8200     ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.559 2013-08-02 14:47:13 cg Exp $'
  8219     ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.560 2013-08-06 08:38:29 cg Exp $'
  8201 !
  8220 !
  8202 
  8221 
  8203 version_CVS
  8222 version_CVS
  8204     ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.559 2013-08-02 14:47:13 cg Exp $'
  8223     ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.560 2013-08-06 08:38:29 cg Exp $'
  8205 ! !
  8224 ! !
  8206 
  8225