Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!bellcore!texbell!uhnix1!sugar!ficc!cliff From: cliff@ficc.uu.net (cliff click) Newsgroups: comp.lang.smalltalk Subject: Re: Smalltalk/V286: moving cursor in Texteditor Summary: TextSelections Message-ID: <4629@ficc.uu.net> Date: 20 Jun 89 13:07:01 GMT References: <16@piyopiyo.hatori.t.u-tokyo.JUNET> Organization: Ferranti International Controls Lines: 50 > A stripped down version of the method I added to TextPane: > ...[bad code removed]... > Has anyone figured out where exactly the cursor gets moved and > the big idea behind TextSelection? A TextSelection is a pair of points. The first point is the selection start, the second is the selection end. If the end is before the start the selection is viewed as a "Gap" or "I-Beam", otherwise a block of text is selected (and displayed in reverse). Here is some code for moving to the start of a line: ! TextPane methods ! jumpLeft "Move the GapSelector (I-Beam) to line start" | line | "Get the previous Y value" line := selection corner y. "Gaps slide both origin and corner left, selections just origin" ^selection isGap ifTrue: [selection origin: (1 @ line) corner: (0 @ line)] ifFalse: [selection origin: (0 @ line)]! ! I don't call any of the routines for handling the various selections, because their smart enough to do proper reverse videoing. The routines which call this simple undo any selection, call this to torture the TextSelection, and re-do any selection based only on the new TextSelection. Good Luck! ========== Private for Ott: WARNING: Your mailer bounced your mail between "piyopiyo" and "ccut.cc.u-tokyo.ac.jp" about 8 times before it got out. My mailer sent my reply back to your mailer, which detected a mail loop, and sent my reply back to me. You need to have your system administraters check it out. Your reply mail transcript contained this repeated about 8 times: Received: from piyopiyo by ccut.cc.u-tokyo.ac.jp (5.61/6.4J.5-ut1.2) id AA01305; Tue, 20 Jun 89 03:25:28 +0900 Received: from ccut.cc.u-tokyo.ac.jp by piyopiyo.hatori.t.u-tokyo.junet (3.2/6.3Junet-1.0) id AA22136; Tue, 20 Jun 89 03:19:55 JST . . . -- Cliff Click, Software Contractor at Large Business: uunet.uu.net!ficc!cliff, cliff@ficc.uu.net, +1 713 274 5368 (w). Disclaimer: lost in the vortices of nilspace... +1 713 568 3460 (h).