TextView.st
changeset 2429 eed79a96e43b
parent 2421 bccbb97e8ab6
child 2442 914a5ef62334
equal deleted inserted replaced
2428:f800d9ec09a8 2429:eed79a96e43b
   832     (y > height) ifTrue:[
   832     (y > height) ifTrue:[
   833         self compressMotionEvents:false.
   833         self compressMotionEvents:false.
   834         self startAutoScrollDown:(y - height).
   834         self startAutoScrollDown:(y - height).
   835         ^ self
   835         ^ self
   836     ].
   836     ].
   837     ((x < 0) and:[leftOffset ~~ 0]) ifTrue:[
   837     ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
   838         self compressMotionEvents:false.
   838         self compressMotionEvents:false.
   839         self startAutoScrollLeft:x.
   839         self startAutoScrollLeft:x.
   840         ^ self
   840         ^ self
   841     ].
   841     ].
   842     (x > width) ifTrue:[
   842     (x > width) ifTrue:[
  1147             self searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
  1147             self searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
  1148                   ifFound:[:line :col | 
  1148                   ifFound:[:line :col | 
  1149                               |prevLine prevCol moveBack pos1|
  1149                               |prevLine prevCol moveBack pos1|
  1150 
  1150 
  1151                               prevLine := firstLineShown.
  1151                               prevLine := firstLineShown.
  1152                               prevCol := leftOffset.
  1152                               prevCol := viewOrigin x.
  1153                               self selectFromLine:selectionStartLine col:selectionStartCol
  1153                               self selectFromLine:selectionStartLine col:selectionStartCol
  1154                                            toLine:line col:col.
  1154                                            toLine:line col:col.
  1155 
  1155 
  1156                               self sensor ctrlDown ifFalse:[
  1156                               self sensor ctrlDown ifFalse:[
  1157                                   "/ undo scroll operation ...
  1157                                   "/ undo scroll operation ...
  1158                                   self withCursor:Cursor eye do:[
  1158                                   self withCursor:Cursor eye do:[
  1159                                       |delayCount|
  1159                                       |delayCount|
  1160 
  1160 
  1161                                       moveBack := false.
  1161                                       moveBack := false.
  1162                                       (')]}>' includes:ch) ifTrue:[
  1162                                       (')]}>' includes:ch) ifTrue:[
  1163                                            (firstLineShown ~~ prevLine or:[prevCol ~~ leftOffset]) ifTrue:[
  1163                                            (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
  1164                                                moveBack := true
  1164                                                moveBack := true
  1165                                            ] 
  1165                                            ] 
  1166                                       ] ifFalse:[
  1166                                       ] ifFalse:[
  1167                                            selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
  1167                                            selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
  1168                                                self makeLineVisible:selectionEndLine.
  1168                                                self makeLineVisible:selectionEndLine.
  2033     "redraw visible line lineNr"
  2033     "redraw visible line lineNr"
  2034 
  2034 
  2035     |len line l|
  2035     |len line l|
  2036 
  2036 
  2037     selectionStartLine notNil ifTrue:[
  2037     selectionStartLine notNil ifTrue:[
  2038 	line := self visibleLineToAbsoluteLine:visLine.
  2038         line := self visibleLineToAbsoluteLine:visLine.
  2039 	(line between:selectionStartLine and:selectionEndLine) ifTrue:[
  2039         (line between:selectionStartLine and:selectionEndLine) ifTrue:[
  2040 	    (line == selectionStartLine) ifTrue:[
  2040             (line == selectionStartLine) ifTrue:[
  2041 		(line == selectionEndLine) ifTrue:[
  2041                 (line == selectionEndLine) ifTrue:[
  2042 		    "its part-of-single-line selection"
  2042                     "its part-of-single-line selection"
  2043 		    self clearMarginOfVisibleLine:visLine with:bgColor.
  2043                     self clearMarginOfVisibleLine:visLine with:bgColor.
  2044 		    (selectionStartCol > 1) ifTrue:[
  2044                     (selectionStartCol > 1) ifTrue:[
  2045 			super redrawVisibleLine:visLine
  2045                         super redrawVisibleLine:visLine
  2046 					   from:1
  2046                                            from:1
  2047 					     to:(selectionStartCol - 1)
  2047                                              to:(selectionStartCol - 1)
  2048 		    ].
  2048                     ].
  2049 		    self drawVisibleLine:visLine from:selectionStartCol
  2049                     self drawVisibleLine:visLine from:selectionStartCol
  2050 						   to:selectionEndCol
  2050                                                    to:selectionEndCol
  2051 						 with:selectionFgColor
  2051                                                  with:selectionFgColor
  2052 						  and:selectionBgColor.
  2052                                                   and:selectionBgColor.
  2053 		    super redrawVisibleLine:visLine
  2053                     super redrawVisibleLine:visLine
  2054 				       from:(selectionEndCol + 1).
  2054                                        from:(selectionEndCol + 1).
  2055 		    ^ self
  2055                     ^ self
  2056 		].
  2056                 ].
  2057 
  2057 
  2058 		"its the first line of a multi-line selection"
  2058                 "its the first line of a multi-line selection"
  2059 		(selectionStartCol ~~ 1) ifTrue:[
  2059                 (selectionStartCol ~~ 1) ifTrue:[
  2060 		    self clearMarginOfVisibleLine:visLine with:bgColor.
  2060                     self clearMarginOfVisibleLine:visLine with:bgColor.
  2061 		    super redrawVisibleLine:visLine
  2061                     super redrawVisibleLine:visLine
  2062 				       from:1
  2062                                        from:1
  2063 					 to:(selectionStartCol - 1)
  2063                                          to:(selectionStartCol - 1)
  2064 		] ifFalse:[
  2064                 ] ifFalse:[
  2065 		    leftOffset == 0 ifTrue:[
  2065                     viewOrigin x == 0 ifTrue:[
  2066 			self clearMarginOfVisibleLine:visLine with:selectionBgColor.
  2066                         self clearMarginOfVisibleLine:visLine with:selectionBgColor.
  2067 		    ]
  2067                     ]
  2068 		].
  2068                 ].
  2069 		self drawVisibleLine:visLine from:selectionStartCol
  2069                 self drawVisibleLine:visLine from:selectionStartCol
  2070 				with:selectionFgColor and:selectionBgColor.
  2070                                 with:selectionFgColor and:selectionBgColor.
  2071 		^ self
  2071                 ^ self
  2072 	    ].
  2072             ].
  2073 
  2073 
  2074 	    (line == selectionEndLine) ifTrue:[
  2074             (line == selectionEndLine) ifTrue:[
  2075 		"its the last line of a multi-line selection"
  2075                 "its the last line of a multi-line selection"
  2076 		(selectionEndCol == 0) ifTrue:[
  2076                 (selectionEndCol == 0) ifTrue:[
  2077 		    ^ super redrawVisibleLine:visLine
  2077                     ^ super redrawVisibleLine:visLine
  2078 		].
  2078                 ].
  2079 		l := self visibleAt:selectionEndLine.
  2079                 l := self visibleAt:selectionEndLine.
  2080 		len := l size.
  2080                 len := l size.
  2081 
  2081 
  2082 		self clearMarginOfVisibleLine:visLine with:selectionBgColor.
  2082                 self clearMarginOfVisibleLine:visLine with:selectionBgColor.
  2083 		self drawVisibleLine:visLine from:1 to:selectionEndCol
  2083                 self drawVisibleLine:visLine from:1 to:selectionEndCol
  2084 				with:selectionFgColor and:selectionBgColor.
  2084                                 with:selectionFgColor and:selectionBgColor.
  2085 		super redrawVisibleLine:visLine from:(selectionEndCol + 1).
  2085                 super redrawVisibleLine:visLine from:(selectionEndCol + 1).
  2086 		^ self
  2086                 ^ self
  2087 	    ].
  2087             ].
  2088 
  2088 
  2089 	    "its a full line in a multi-line selection"
  2089             "its a full line in a multi-line selection"
  2090 	    self clearMarginOfVisibleLine:visLine with:selectionBgColor.
  2090             self clearMarginOfVisibleLine:visLine with:selectionBgColor.
  2091 	    self drawVisibleLine:visLine with:selectionFgColor and:selectionBgColor.
  2091             self drawVisibleLine:visLine with:selectionFgColor and:selectionBgColor.
  2092 	    ^ self
  2092             ^ self
  2093 	]
  2093         ]
  2094     ].
  2094     ].
  2095     super redrawVisibleLine:visLine
  2095     super redrawVisibleLine:visLine
  2096 
  2096 
  2097     "Modified: 6.3.1996 / 14:22:19 / cg"
  2097     "Modified: 6.3.1996 / 14:22:19 / cg"
  2098 !
  2098 !
  3222 ! !
  3222 ! !
  3223 
  3223 
  3224 !TextView class methodsFor:'documentation'!
  3224 !TextView class methodsFor:'documentation'!
  3225 
  3225 
  3226 version
  3226 version
  3227     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.171 2001-10-02 18:03:26 cg Exp $'
  3227     ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.172 2001-10-05 08:56:11 cg Exp $'
  3228 ! !
  3228 ! !