11 " |
11 " |
12 |
12 |
13 TextView subclass:#EditTextView |
13 TextView subclass:#EditTextView |
14 instanceVariableNames:'cursorLine cursorVisibleLine cursorCol cursorShown |
14 instanceVariableNames:'cursorLine cursorVisibleLine cursorCol cursorShown |
15 prevCursorState readOnly modified fixedSize exceptionBlock |
15 prevCursorState readOnly modified fixedSize exceptionBlock |
16 cursorFgColor cursorBgColor cursorType undoAction |
16 cursorFgColor cursorBgColor cursorType undoAction typeOfSelection |
17 typeOfSelection lastString lastReplacement lastAction replacing |
17 lastString lastReplacement lastAction replacing |
18 showMatchingParenthesis hasKeyboardFocus acceptAction lockUpdates |
18 showMatchingParenthesis hasKeyboardFocus acceptAction lockUpdates |
19 tabMeansNextField' |
19 tabMeansNextField' |
20 classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor |
20 classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor |
21 DefaultCursorType' |
21 DefaultCursorType' |
22 poolDictionaries:'' |
22 poolDictionaries:'' |
2092 |
2092 |
2093 see TextView>>:x:y |
2093 see TextView>>:x:y |
2094 " |
2094 " |
2095 (('[fF][0-9]' match:key) |
2095 (('[fF][0-9]' match:key) |
2096 or:['[fF][0-9][0-9]' match:key]) ifTrue:[ |
2096 or:['[fF][0-9][0-9]' match:key]) ifTrue:[ |
2097 device shiftDown ifFalse:[ |
2097 self sensor shiftDown ifFalse:[ |
2098 fKeyMacros := Smalltalk at:#FunctionKeySequences. |
2098 fKeyMacros := Smalltalk at:#FunctionKeySequences. |
2099 fKeyMacros notNil ifTrue:[ |
2099 fKeyMacros notNil ifTrue:[ |
2100 (fKeyMacros includesKey:key) ifTrue:[ |
2100 (fKeyMacros includesKey:key) ifTrue:[ |
2101 self pasteOrReplace:(fKeyMacros at:key) asStringCollection. |
2101 self pasteOrReplace:(fKeyMacros at:key) asStringCollection. |
2102 ^ self |
2102 ^ self |
2214 ]. |
2214 ]. |
2215 ^self |
2215 ^self |
2216 ]. |
2216 ]. |
2217 |
2217 |
2218 (key == #Tab) ifTrue:[ |
2218 (key == #Tab) ifTrue:[ |
2219 device shiftDown ifTrue:[ |
2219 self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y]. |
|
2220 |
|
2221 self sensor shiftDown ifTrue:[ |
2220 " |
2222 " |
2221 the old version used shift-tab as backtab, |
2223 the old version used shift-tab as backtab, |
2222 however, backtab was seldom used. |
2224 however, backtab was seldom used. |
2223 An alternative is to make it a non-inserting tab ... |
2225 An alternative is to make it a non-inserting tab ... |
2224 " |
2226 " |
2225 "/ self unselect. self cursorBacktab. ^self |
2227 "/ self unselect. self cursorBacktab. |
2226 self unselect. self cursorTab. ^self |
2228 self unselect. self cursorTab. |
|
2229 ^self |
2227 ]. |
2230 ]. |
|
2231 |
2228 " |
2232 " |
2229 uncomment line below, if you like RAND/INed/MAXed editor behavior |
2233 uncomment line below, if you like RAND/INed/MAXed editor behavior |
2230 (where tab-key is only cursor positioning) |
2234 (where tab-key is only cursor positioning) |
2231 this was the original behavior of the TAB key, but many people |
2235 this was the original behavior of the TAB key, but many people |
2232 complained .... |
2236 complained .... |
2233 " |
2237 " |
2234 "/ self unselect. self cursorTab. ^self |
2238 "/ self unselect. self cursorTab. ^self |
2235 self unselect. self insertTabAtCursor. ^self |
2239 self unselect. self insertTabAtCursor. |
|
2240 ^self |
2236 ]. |
2241 ]. |
2237 |
2242 |
2238 (key == #BackSpace) ifTrue:[ |
2243 (key == #BackSpace) ifTrue:[ |
2239 |
2244 |
2240 "/ old version just unselected here |
2245 "/ old version just unselected here |
2773 contentsWasSaved := false |
2778 contentsWasSaved := false |
2774 ! ! |
2779 ! ! |
2775 |
2780 |
2776 !EditTextView methodsFor:'queries'! |
2781 !EditTextView methodsFor:'queries'! |
2777 |
2782 |
2778 canTab |
2783 tabMeansNextField |
2779 "return true, if a Tab character should shift focus." |
2784 "return true, if a Tab character should shift focus." |
2780 |
2785 |
2781 "if not readOnly, I want my tab keys ..." |
2786 "if not readOnly, I want my tab keys ..." |
2782 |
2787 |
2783 ^ readOnly or:[tabMeansNextField] |
2788 ^ readOnly or:[tabMeansNextField] |
|
2789 |
|
2790 "Created: 7.2.1996 / 19:15:31 / cg" |
2784 ! |
2791 ! |
2785 |
2792 |
2786 widthOfContents |
2793 widthOfContents |
2787 "return the width of the contents in pixels |
2794 "return the width of the contents in pixels |
2788 Redefined to add the size of a space (for the cursor). |
2795 Redefined to add the size of a space (for the cursor). |